Commit 9d95547e by BellCodeEditor

save project

parent 0b986e23
Showing with 9 additions and 2 deletions
...@@ -10,7 +10,14 @@ ...@@ -10,7 +10,14 @@
# # file1.close() # # file1.close()
# with open(r'C:\Users\pc\Desktop\bellcode\test.txt','a',encoding='utf-8') as file: # with open(r'C:\Users\pc\Desktop\bellcode\test.txt','a',encoding='utf-8') as file:
# file.write('王五:102365489\n') # file.write('王五:102365489\n')
new_a=''
with open(r'C:\Users\pc\Desktop\bellcode\test.txt','r',encoding='utf-8') as file: with open(r'C:\Users\pc\Desktop\bellcode\test.txt','r',encoding='utf-8') as file:
for a in file: for a in file:
if '王五:102365489' in a: if '王五:102365489' in a:
print('yes') a=a.replace('王五:102365489','王五:5541532253155342')
\ No newline at end of file
new_a +=a
with open(r'C:\Users\pc\Desktop\bellcode\test.txt','w',encoding='utf-8') as file1:
file1.write(new_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