Commit c07659c5 by BellCodeEditor

save project

parent c07ebb2a
Showing with 4 additions and 4 deletions
new_data='' new_i=''
a=open('C:\\Users\\Windows 7\\Desktop\\test.txt','r',encoding='utf-8') a=open('C:\\Users\\Windows 7\\Desktop\\test.txt','r',encoding='utf-8')
#a.write('小兰:12本\n') #a.write('小兰:12本\n')
#a.write('小强:10本\n') #a.write('小强:10本\n')
...@@ -7,5 +7,5 @@ a=open('C:\\Users\\Windows 7\\Desktop\\test.txt','r',encoding='utf-8') ...@@ -7,5 +7,5 @@ a=open('C:\\Users\\Windows 7\\Desktop\\test.txt','r',encoding='utf-8')
for i in a: for i in a:
if '小强:10本' in i: if '小强:10本' in i:
print('小强在文件中') print('小强在文件中')
data=data.replace('小强:10本','小强:11本') i=i.replace('小强:10本','小强:11本')
new_data+=data new_i+=i
\ No newline at end of file \ 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