Commit 81aa8207 by BellCodeEditor

auto save

parent 41e03761
Showing with 19 additions and 4 deletions
li=['小','虎','语'] file=open('C:\\Users\\29018\\Desktop\\test.txt','w',encoding='utf-8')
file=open('C:\\Users\\29018\\Desktop\\test.txt','a',encoding='utf-8') file.write("d")
file.writelines(li) file.close()
\ No newline at end of file
file=open('C:\\Users\\29018\\Desktop\\test.txt','r',encoding='utf-8')
'''for i in file:
if "d" in i:
print("在文件里")'''
lanzi=""
for i in file:
if "d" in i:
xin=i.replace("d","o")
lanzi=lanzi+xin
file=open('C:\\Users\\29018\\Desktop\\test.txt','w',encoding='utf-8')
file.write(lanzi)
print(lanzi)
file.close()
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