用户:
勇敢的月见花isyQ查看:0 回复:1 评论:0 创建时间:2020-09-16T18:14:22
【作品展示】

【作品介绍】
自编字典,你自己编
【作品源代码】
import pickle
dic = {}
while True:
a = input('dictionary\na for add \nl for look\ns for start with\nq for quit')
if a == 'a':
word = input("word ")
def_ = input("defintion ")
dic[word] = def_
print("end\n-------------------")
mi_dic[word] = def_
pickle.dump(mi_dic)
elif a == 'l':
word = input('word')
if word in dic.keys():
print(dic[word], "\nend\n-------------------")
else:
print("isn`t in dictionary\nend\n-------------------")
elif a == 's':
up = input('the start')
for i in range(len(dic)):
list_ = list(dic)#using index
if list_[i].startswith(up):
print(list_[i], "starts with", up, "\nend\n-------------------")
elif a == 'q':
print("all of your dic will be delete")
if input('ready?(y/n)') == 'y':
break
#字典程序
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn