Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-1
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
d1858db0
authored
Aug 01, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
39545215
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
diy.py
sales_list.txt
diy.py
View file @
d1858db0
with
open
(
r"c:\Users\intel\Documents\lesson13-1\sales_list.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
file1
:
a
=
file1
.
readlines
()
print
(
a
)
#print(a)
lixin
=
[]
for
i
in
a
:
newi
=
i
.
split
()
sum
=
0
for
q
in
newi
[
1
:]:
sum
=
int
(
q
)
+
sum
sum1
=
newi
[
0
]
+
str
(
sum
)
print
(
sum1
)
#print(sum)
sum1
=
newi
[
0
]
+
str
(
sum
)
+
"
\n
"
#print(sum1)
lixin
.
append
(
sum1
)
with
open
(
r"c:\Users\intel\Documents\lesson13-1\sales_list.txt"
,
"a"
,
encoding
=
"utf-8"
)
as
file2
:
file2
.
writelines
(
lixin
)
sales_list.txt
View file @
d1858db0
...
...
@@ -10,4 +10,4 @@
刘若若 11 11 13 11 20 15 13 29 24
刘阳 11 15 22 11 23 26 22 15 17 52 12
王胜男 27 15 15 26 13 12 15
王娇 12 11 12 12 15 35 23 11
\ No newline at end of file
王娇 12 11 12 12 15 35 23 11悟空348/n诺依380/n小贝182/n李丽201/n宋扬107/n王明245/n李强164/n孙小白222/n苏琪137/n刘若若147/n刘阳226/n王胜男123/n王娇131/n
\ 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