Commit 40a14416 by BellCodeEditor

save project

parent b662f8f1
Showing with 19 additions and 8 deletions
with open(r'c:\Users\admin\Desktop\JLGJFD.txt.txt','r',encoding='utf-8') as file: with open(r'C:\Users\QC\Desktop\新建文本文档.txt','w',encoding='utf-8')as qwe:
a=file.readlines() qwe.write('小明:21\n小可:21\n小红:21\n')
# print(type(a[3:5])) with open(r'C:\Users\QC\Desktop\新建文本文档.txt','r',encoding='utf-8')as qwe:
for i in a: a=qwe.read()
ad=i.split() print(a)
print(ad[0]) nqwe=''
print(ad[1:]) with open(r'C:\Users\QC\Desktop\新建文本文档.txt','r',encoding='utf-8')as qwe:
\ No newline at end of file for poi in qwe:
if '小明:21' in poi:
print('数据在文件中')
poi=poi.replace('小明:21','小明:30')
nqwe+=poi
with open(r'C:\Users\QC\Desktop\新建文本文档.txt','w',encoding='utf-8')as qwe:
qwe.write(nqwe)
\ 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