Commit 58fe1158 by BellCodeEditor

save project

parent fb1e6fe8
Showing with 7 additions and 3 deletions
......@@ -4,7 +4,11 @@ filel.write('小兰:12本')
filel.close()
with open(r'C:\Users\Administrator\Desktop\test.txt',"a",encoding='utf-8') as filel:
filel.write("小强:10本")
new_data="
with open(r'C:\Users\Administrator\Desktop\test.txt',"r",encoding='utf-8') as filel:
with open(r'C:\Users\Administrator\Desktop\test.txt',"r",encoding='utf-8') as filel:
for data in data:
if '小兰:12本' in data:
print('数据在文件中')
\ No newline at end of file
if '小强:12本' in data:
data=data.replace('小强:12本','小强:10本')
new_data+=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