2016年11月20日

python文件操作

摘要: 对文件操作流程 基本操作 1 2 3 4 5 6 7 8 f = open('lyrics') #打开文件 first_line = f.readline() print('first line:',first_line) #读一行 print('我是分隔线'.center(50,'-')) dat 阅读全文

posted @ 2016-11-20 11:20 裤裆内隐藏杀气 阅读(231) 评论(0) 推荐(0) 编辑

编写购物车

摘要: count=0flag=Trueusername='lisi'password='lisi'f=open('salary.txt','r+')#存放用户的余额file_list=int(f.readline())f.seek((0))f.write(str(file_list))f.close()# 阅读全文

posted @ 2016-11-20 11:16 裤裆内隐藏杀气 阅读(289) 评论(0) 推荐(0) 编辑

导航