Commit eb6dd49a by BellCodeEditor

save project

parent 6724a849
Showing with 6 additions and 2 deletions
sb=""
with open(r"C:\Users\WeiBo\Desktop\teft2.txt","r",encoding="utf-8") as filel : with open(r"C:\Users\WeiBo\Desktop\teft2.txt","r",encoding="utf-8") as filel :
for data in filel: for data in filel:
if"小强:10本"in data: if"小强:10本"in data:
print("数据在文件中") data=data.replace("小强:10本","小强:20本")
\ No newline at end of file sb+=data
with open(r"C:\Users\WeiBo\Desktop\teft2.txt","w",encoding="utf-8") as filel :
filel.write(sb)
\ 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