通讯录读取

n = input()
dict1 = dict()
with open('info.csv', 'r', encoding='GBK') as f:
for line in f.readlines():
line = line.strip('/n')
ls = list(line.split(','))
ls1 = ls[1:]
dict1[ls[0]] = ls1

if n == 'A':
with open('info.csv', 'r', encoding='GBK') as f:
for line in f.readlines():
line = line.strip('/n')
line = line.replace(',', ' ')
print(line)
elif n == 'D':
print(dict1)
else:
print('ERRO

通讯录读取最先出现在Python成神之路

版权声明:
作者:dingding
链接:https://www.techfm.club/p/17086.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>