Commit 6c32dc62 by BellCodeEditor

save project

parent 6d275ad5
Showing with 11 additions and 3 deletions
...@@ -8,6 +8,14 @@ ...@@ -8,6 +8,14 @@
# with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt",'r',encoding='utf-8') as file1: # with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt",'r',encoding='utf-8') as file1:
# n=file1.read() # n=file1.read()
# print(n) # print(n)
new_d=""
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt",'r',encoding='utf-8') as file1: with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt",'r',encoding='utf-8') as file1:
for i in file1: for d in file1:
print(i) if "小兰:12本" in d:
\ No newline at end of file d=d.replace("小兰:12本","小兰:1本")
new_d+=d
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt",'w',encoding='utf-8') as file1:
file1.write(new_d)
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt",'r',encoding='utf-8') as file1:
n=file1.read()
print(n)
\ 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