Commit db8196f4 by BellCodeEditor

save project

parent 79a25dd7
Showing with 16 additions and 0 deletions
new_data=''
with open("C:\Users\dell\Desktopbook.txt"'r'encoding='utf-8')as,file 1:
for data in file:
if"小强:10本"in data
data=datareplace('小强:10','小强:14本')
if"小兰:12本"in data
data=datareplace('小兰:12','小兰:14本')
new_data+=data
with open("C:\Users\dell\Desktopbook.txt"'w'encoding='utf-8')as,file 1:
file.write(new_data)
with open("C:\Users\dell\Desktopbook.txt"'r'encoding='utf-8')as,file:
a=file 1.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