Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-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
604cb9b9
authored
Jun 27, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
12755e16
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
diy.py
new_sales_list.txt
sales_list.txt
diy.py
View file @
604cb9b9
#file = open(r"C:\Users\no3\Documents\lesson12-1\sales_list.txt",'r',encoding='utf-8')
final_sum
=
[]
with
open
(
r'C:\Users\no3\Documents\lesson12-1\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
a
=
file
.
readlines
()
for
i
in
a
:
...
...
@@ -6,4 +7,7 @@ with open(r'C:\Users\no3\Documents\lesson12-1\sales_list.txt','r',encoding='utf-
sum
=
0
for
sales
in
data
[
1
:]:
sum
+=
int
(
sales
)
print
(
data
[
0
]
sum
)
\ No newline at end of file
result
=
data
[
0
]
+
str
(
sum
)
+
'
\n
'
final_sum
.
append
(
result
)
with
open
(
r'C:\Users\no3\Documents\lesson12-1\new_sales_list.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
file
:
file
.
writelines
(
final_sum
)
\ No newline at end of file
new_sales_list.txt
0 → 100644
View file @
604cb9b9
悟空153
小贝167
诺依165
sales_list.txt
View file @
604cb9b9
悟空 12 15 11 12 11 12 14 13 15 17 21
小贝 11 14 17 14 19 10 17 16 15 14 20
诺依 12 17 15 14 13 19 18 11 11 10 25
诺依 12 17 15 14 13 19 18 11 11 10 25
\ 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