Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson14_2
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5e553df7
authored
Jun 26, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
70850cf8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
diy2.py
diy2.py
View file @
5e553df7
with
open
(
r'C:\Users\yd\Desktop\锦瑟.txt'
,
'w'
,
encoding
=
'utf-8'
)
as
f1
:
f1
.
write
(
' 锦瑟
\n
'
' [唐] 李商隐
\n
'
'锦瑟⽆端五⼗弦,
\n
'
'⼀弦⼀柱思华年。
\n
'
'庄⽣晓梦迷蝴蝶,
\n
'
'望帝春⼼托杜鹃。
\n
'
'沧海⽉明珠有泪,
\n
'
'蓝⽥⽇暖⽟⽣烟。
\n
'
'此情可待成追忆,
\n
'
'只是当时已惘然。
\n
'
)
new_date
=
[]
with
open
(
r'C:\Users\yd\Desktop\锦瑟.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f2
:
date
=
f2
.
readlines
()
for
i
in
date
:
if
'蓝⽥⽇暖⽟⽣烟。
\n
'
==
i
:
new_date
.
append
(
'________________。
\n
'
)
elif
'此情可待成追忆,
\n
'
==
i
:
new_date
.
append
(
'________________,
\n
'
)
else
:
new_date
.
append
(
i
)
print
(
new_date
)
with
open
(
r'C:\Users\yd\Desktop\锦瑟.txt'
,
'w'
,
encoding
=
'utf-8'
)
as
f3
:
f3
.
writelines
(
new_date
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment