Commit 8e5aca1b by BellCodeEditor

save project

parent dd3c326f
Showing with 16 additions and 0 deletions
#file=open(r'C:\Users\Administrator\Desktop\text.txt',"w",encoding='utf-8')
#file.write('小兰:12本\n')
#file.write('李明:15本\n')
with open(r'C:\Users\Administrator\Desktop\text.txt',"r",encoding='utf-8')as file:
a=file.read()
if "小兰:12本" in a:
b=a.replace("小兰:12本","小兰:10本")
with open(r'C:\Users\Administrator\Desktop\text.txt',"w",encoding='utf-8')as file:
file.write(a)
str='我有两个苹果'
str.replace('两','三')
print(str)
\ 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