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
2e4935ae
authored
Jun 19, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
886820ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
diy.py
sales_list.txt
diy.py
View file @
2e4935ae
with
open
(
r'c:\Users\86135\Documents\lesson13-1\sales_list.txt'
)
as
file
:
class
Hero
:
a
=
file
.
readlines
()
def
_init_
(
seif
):
final_sum
=
[]
seif
.
level
=
i
for
i
in
a
:
seif
.
hp
=
200
data
=
i
.
split
()
seif
.
attack
=
232323232
sum
=
e
yase
=
Hero
()
for
i
in
data
print
(
"yase的血量"
,
yase
.
hp
)
sum
=
sum
+
str
(
b
)
\ No newline at end of file
result
=
data
[
0
](
sum
)
+
'
\n
'
final_sum
.
append
while
open
(
r'c:\Users\86135\Documents\lesson13-1\sales_list.txt'
.
'a'
,
encoding
=
'utf-8'
)
file
.
writelines
(
final_
)
\ No newline at end of file
sales_list.txt
View file @
2e4935ae
...
@@ -11,5 +11,17 @@
...
@@ -11,5 +11,17 @@
刘阳 11 15 22 11 23 26 22 15 17 52 12
刘阳 11 15 22 11 23 26 22 15 17 52 12
王胜男 27 15 15 26 13 12 15
王胜男 27 15 15 26 13 12 15
王娇 12 11 12 12 15 35 23 11
王娇 12 11 12 12 15 35 23 11
with open(r'c:\Users\86135\Documents\lesson13-1\sales_list.txt') as file:
a=file.readlines()
final_sum=[]
for i in a:
data=i.split()
sum=e
for i in data
sum=sum+str(b)
result=data[0](sum)+'\n'
final_sum.append
while open(r'c:\Users\86135\Documents\lesson13-1\sales_list.txt'.'a',encoding='utf-8')
file.writelines(final_)
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