Commit 62c58381 by BellCodeEditor

save project

parent dae17c5a
Showing with 32 additions and 17 deletions
with open(r'c:\Users\admin\Desktop\大智的文件.txt','r',encoding='utf-8') as file:
#data=file.read()
new_data=''
for data in file:
if '蓝田日暖玉生烟。' in data:
data=data.replace('蓝田日暖玉生烟。','________________')
if '此情可待成追忆,' in data:
data=data.replace('此情可待成追忆,','________________')
new_data+=data
with open(r'c:\Users\admin\Desktop\大智的文件.txt','w',encoding='utf-8') as file:
file.writelines(new_data)
\ No newline at end of file
a='罗恩 23 35 44\n'
b='哈利 60 77 68 88 90\n'
c='赫敏 97 99 89 91 95 90\n'
d='马尔福 100 85 90\n'
with open(r'c:\Users\admin\Desktop\scores.txt','w',encoding='utf-8') as file:
file.write(a)
file.write(b)
file.write(c)
file.write(d)
\ No newline at end of file
a=['锦\n','[唐]李商隐\n'] a=['锦\n','[唐]李商隐\n']
...@@ -4,18 +4,10 @@ d=['庄生晓梦迷蝴蝶,\n','望帝春心托杜鹃。\n'] ...@@ -4,18 +4,10 @@ d=['庄生晓梦迷蝴蝶,\n','望帝春心托杜鹃。\n']
e=['沧海月明珠有泪,\n','蓝田日暖玉生烟。\n'] e=['沧海月明珠有泪,\n','蓝田日暖玉生烟。\n']
f=['此情可待成追忆,\n','只是当时已惘然。\n'] f=['此情可待成追忆,\n','只是当时已惘然。\n']
g=['谁打开这个文档,谁就是傻逼(作者除外)。'] g=['谁打开这个文档,谁就是傻逼(作者除外)。']
#with open(r'c:\Users\admin\Desktop\大智的文件.txt','a',encoding='utf-8') as b: with open(r'c:\Users\admin\Desktop\大智的文件.txt','w',encoding='utf-8') as b:
#b.writelines(a) b.writelines(a)
#b.writelines(c) b.writelines(c)
#b.writelines(d) b.writelines(d)
#b.writelines(e) b.writelines(e)
#b.writelines(f) b.writelines(f)
with open(r'c:\Users\admin\Desktop\大智的文件.txt','r',encoding='utf-8') as file: b.writelines(g)
a=file.read() \ No newline at end of file
# a.replace('蓝田日暖玉生烟。','____________\n')
# a.replace('此情可待成追忆。','____________\n')
print(a)
with open(r'c:\Users\admin\Desktop\大智的文件.txt','w',encoding='utf-8') as file:
# a.replace('蓝田日暖玉生烟。','____________\n')
# a.replace('此情可待成追忆。','____________\n')
print(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