Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13_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
dae17c5a
authored
Jul 21, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
14ee9df9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
diy.py
练习.py
练习。py
diy.py
View file @
dae17c5a
with
open
(
r'c:\Users\admin\Desktop\大智的文件.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
a
:
b
=
a
.
readlines
()
final_sum
=
[]
for
i
in
b
:
c
=
i
.
split
()
#print(c[1:])
sum
=
0
for
d
in
c
[
1
:]:
sum
=
sum
+
int
(
d
)
e
=
c
[
0
]
+
str
(
sum
)
print
(
e
)
\ No newline at end of file
e
=
c
[
0
]
+
str
(
sum
)
+
'
\n
'
final_sum
.
append
(
e
)
with
open
(
r'c:\Users\admin\Desktop\大智的文件.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
a
:
a
.
writelines
(
final_sum
)
\ No newline at end of file
练习.py
0 → 100644
View file @
dae17c5a
a
=
[
'锦瑟
\n
'
,
'[唐]李商隐
\n
'
]
a
=
[
'锦瑟
\n
'
,
'[唐]李商隐
\n
'
]
c
=
[
'锦瑟无端五十弦,
\n
'
,
'一线一柱思华年。
\n
'
]
d
=
[
'庄生晓梦迷蝴蝶,
\n
'
,
'望帝春心托杜鹃。
\n
'
]
e
=
[
'沧海月明珠有泪,
\n
'
,
'蓝田日暖玉生烟。
\n
'
]
f
=
[
'此情可待成追忆,
\n
'
,
'只是当时已惘然。
\n
'
]
g
=
[
'谁打开这个文档,谁就是傻逼(作者除外)。'
]
#with open(r'c:\Users\admin\Desktop\大智的文件.txt','a',encoding='utf-8') as b:
#b.writelines(a)
#b.writelines(c)
#b.writelines(d)
#b.writelines(e)
#b.writelines(f)
with
open
(
r'c:\Users\admin\Desktop\大智的文件.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
a
=
file
.
read
()
# 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
练习。py
0 → 100644
View file @
dae17c5a
a=[]
a=[]
\ 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