Commit fc2cd477 by BellCodeEditor

save project

parent ee8e45ca
Showing with 11 additions and 3 deletions
......@@ -3,13 +3,20 @@
file = open(r"C:\Users\chen\Desktop\text\text.txt","r",encoding="UTF-8")
#写
a = file.readlines()
new_data = ""
for i in a:
print(i)
if "小兰" in i:
print("在")
print(i)
b = i.replace('小兰:12本','小兰:13本')
print (b)
b =i.replace('小兰:12本','小兰:13本')
new_data += b
else:
new_data += i
print("不在")
#关
file.close()
print (new_data)
file = open(r"C:\Users\chen\Desktop\text\text.txt","w",encoding="UTF-8")
file.write( new_data)
file.close()
\ 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