基于Python的通讯录
所要完成的基本功能:
- 添加联系人
- 删除联系人
- 搜索联系人
- 浏览联系人
- 将联系人保存为文件
代码
'''
通讯录:
可以浏览、添加、删除、搜索联系人
储存信息包括:姓名、性别、类别(朋友、同学、家人)、电话
'''
#登录引导界面
txt = '''
1. add contacts
2. delete contacts
3. search contacts
4. show all contacts
5. exit the system
'''
#检测路径下是否存在通讯录文件,如果没有则建立文件
import os.path
is_exist = os.path.isfile('E:\\FROM Y410P\\学习\\Python程序联系\\作业\\用户管理程序\\Contacts.txt')
if is_exist == 0:
new_file = open('Contacts.txt', 'w')
new_file.close()
#入口程序
def start():
#设置循环,当用户输入特定选项退出
while