猫史档案馆


【Python作品分享】密码加密器【作品秀】

用户:刘骏森刘骏森查看:0 回复:0 评论:0 创建时间:2022-09-09T18:05:05


【作品展示】

center_image

 

【作品介绍】

没有文件的记得先创建!

求回复!

 

【作品源代码】

from easygui import *
import json
Dict = {}
def write_in_file(key, value):
    with open(r'密码和秘密.json','a') as f:
        Dict[key] = value
        json.dump(Dict,f)
def read_file():
    with open(r'密码和秘密.json','r') as f:
        json.load(Dict,f)
choice = None
while choice != '退出':
    choice = choicebox('选择:',choices=['加密','解密','退出'])
    if choice == '加密':
        password = enterbox('输入密码:')
        secret = enterbox('输入秘密:')
        write_in_file(password,secret)
    elif choice == '解密':
        password = enterbox('输入要解密的密码:')
        try:
            msgbox('秘密是' + str(Dict[password]))
        except:
            msgbox('没有这个密码或秘密')

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页