Commit 34c3afd7 by BellCodeEditor

save project

parent 488c8888
Showing with 5 additions and 1 deletions
......@@ -2,7 +2,10 @@
#"C:\Users\Student\Desktop\book.txt"
#filel=open(r'C:\Users\Student\Desktop\test.txt','w',encoding='utf-8')
#filel.write("'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'、,'w',encoding='utf-8'")
new_data=' '
with open(r'C:\Users\Student\Desktop\test.txt','r',encoding='utf-8') as file:
for data in file:
if '小强:10本' in data:
print('数据在文件中')
data=d.replace('小强:10本','小强:11本')
new_data +=data
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