Commit 56b38d0d by BellCodeEditor

save project

parent eb803ae2
Showing with 10 additions and 4 deletions
......@@ -143,10 +143,16 @@ with open(r"C:\Uses\CM\Desktop\book.txt","w",encoding="utf-8") as file:
new_data=''
with open(r"C:\Uses\CM\Desktop\book.txt","w",encoding="utf-8") as file:
for data in file1:
if'小兰:12本' in data:
print('小兰在')
data=data replace('小兰:12本','小兰:10本')
if'李文:9本' in data:
print('李文在'')
\ No newline at end of file
data=data replace('李文:9本','李文:10本')
new_data+=data
with open(r"C:\Uses\CM\Desktop\book.txt","w",encoding="utf-8") as file:
file1.write(new_data)
with open(r"C:\Uses\CM\Desktop\book.txt","w",encoding="utf-8") as file:
a=file1.read()
print(a)
\ 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