#1.文件操作之追加数据01:f = open("yesterday01",'a+U',encoding="utf-8")#a= append,追加之意,w则为写入并覆盖,r为只读,+表示可同时读写,# U表示在读取时,可以将\r \n \r\n自动转换为\n,如 r+U,b表示处理的是二进制文件(如ftp需用rb,wb) f.write("\nwhen i was young I like to listen to the radio\n")d…
day03 上周回顾_问题总结: 地址值: li = [] name = ['name','price','count'] dic = {} #如果这里定义空列表,后边的dic[name[i]] = l2[i],就会把原来的值的地址替换掉: with open("a.txt",mode="r+") as f: for line in f: l2 = line.strip().split() # print(l2) # dic = {} for i in range(…