Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-3
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
45cb1519
authored
Jul 29, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
47d1db5c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
diy.py
diy.py
View file @
45cb1519
ith
open
(
r"c:\Users\欧阳嘉锐\Documents\lesson13-3\sales_list.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
file
:
w
ith
open
(
r"c:\Users\欧阳嘉锐\Documents\lesson13-3\sales_list.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
file
:
str
=
file
.
readlines
()
a
=
[]
for
data
in
str
:
new_data
=
data
.
split
()
sum
=
0
for
i
in
new_data
[
1
:]
for
i
in
new_data
[
1
:]
:
sum
+=
int
(
i
)
new_str
=
str
(
new_data
[
0
])
print
(
type
(
new_str
[
0
]))
#print(new_data[0])
#print(new_data[1:])
\ No newline at end of file
result
=
new_data
[
0
]
+
str
(
sum
)
a
.
append
(
result
)
print
(
result
)
with
open
(
r"c:\Users\欧阳嘉锐\Documents\lesson13-3\sales_list.txt"
,
"a"
,
encoding
=
"utf-8"
)
as
file
:
\ 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