Commit 4065e298 by BellCodeEditor

auto save

parent 024fb164
Showing with 18 additions and 0 deletions
#使用两种方法来修改文件地址!
#1.在地址前面加r
#2.把地址里面的一个反斜杠写为两个反斜杠
#r,read为只读,w,write为只写,a,append,追加
new_d=''
with open(r"C:\Users\DELL\Desktop\taxt.txt",'w',encoding='utf-8') as file1:
# file1.write("李一:20本\n")
# file1.write("李二:30本\n")
# file1.write("李三:40本\n")
for d in file1:
if '李一:10本' in d:
d.replace('李一:10本','李一:11本')
new_d+=d
file1.write(new_d)
#a=open("C:\\Users\\DELL\\Desktop\\text.txt")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment