摘要: # username = input("please enter your name:")# passport = input("please enter your passport:")# with open("list of info",mode="w", encoding="utf-8" ) 阅读全文
posted @ 2018-09-01 16:03 心远志高 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 有些文件太大,不能直接读写,需要一行一行的读,用一个for循环# f = open("log", mode="r+", encoding="utf-8")## for line in f:# print(line)## f.close()with open 打开文件操作可以自动关闭,不需要加f.cl 阅读全文
posted @ 2018-09-01 15:37 心远志高 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #set > set# str# lis = [11,2,3,4]## for i in range(len(lis)):# print(i)## del lis[i]# print(lis)# # print(lis)# lis = [11,22,33,44]## for i in range(l 阅读全文
posted @ 2018-09-01 14:44 心远志高 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #非文字类文件,用rb,上传下载都是二进制,utf-8,gbk形式rb# f = open('f:\\123.txt', mode="rb",)# content = f.read()# f.write("you ae".encode("utf-8"))# print(content)# print 阅读全文
posted @ 2018-09-01 14:44 心远志高 阅读(182) 评论(0) 推荐(0) 编辑