Commit 9cbd67ed by BellCodeEditor

save project

parent d07b8106
Showing with 10 additions and 5 deletions
......@@ -6,12 +6,17 @@
#a.write('张伟:16本\n')
#a.write('爸爸:1100000000000000本\n')
#a.close()
#with open(r'C:\Users\Windows 7\Desktop\1.txt','r',encoding='utf-8') as a:
s=''
with open(r'C:\Users\Windows 7\Desktop\1.txt','r',encoding='utf-8') as a:
#a.write('小兰:12本\n')
#a.write('爸爸:1100000000000000本\n')
#b=a.read()
#print(b)
a=open(r'C:\Users\Windows 7\Desktop\1.txt','r',encoding='utf-8')
for i in a:
if'张伟' in i:
print('数据在文件中')
#a=open(r'C:\Users\Windows 7\Desktop\1.txt','r',encoding='utf-8')
for i in a:
if'张伟:16本' in i:
#print('数据在文件中')
i=i.replace('张伟:16本','张伟,9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999本')
s +=i
with open(r'C:\Users\Windows 7\Desktop\1.txt','w',encoding='utf-8') as a:
a.write(s)
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