Commit 7b11bddd by BellCodeEditor

save project

parent ac9ab4d4
Showing with 5 additions and 2 deletions
......@@ -4,7 +4,10 @@
#file1.write("李文:9本")
#file1.write("张伟:16本")
#file1.close()
new_data=""
with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='utf-8')as file1:
for data in file1:
if '刘强:15本' in data:
print("yes")
\ No newline at end of file
data.replace("刘强:15本","刘强:10本")
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