Commit 54040921 by BellCodeEditor

save project

parent fe404e52
Showing with 6 additions and 2 deletions
...@@ -7,8 +7,11 @@ a=file.read() ...@@ -7,8 +7,11 @@ a=file.read()
print(a) print(a)
file.close() file.close()
new_data=""
file=open(r'C:\Users\AA\Desktop\test.txt','r',encoding='utf-8') file=open(r'C:\Users\AA\Desktop\test.txt','r',encoding='utf-8')
for i in file: for i in file:
if '国' in i: if '国庆' in i:
print("所查找内容在文件里") new=i.replace('国庆','中秋')
new_data=new_+data+new
print(new_data)
\ 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