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
e54ee487
authored
Jun 16, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
513e02d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
diy.py
diy.py
View file @
e54ee487
with
open
(
r'c:\Users\刘释远\Documents\lesson13-1\sales_list.txt'
,
'r'
,
encoding
=
'utf_8'
)
as
h
:
with
open
(
r'c:\Users\刘释远\Documents\lesson13-1\sales_list.txt'
,
'r'
,
encoding
=
'utf_8'
)
as
h
:
#打开文件
a
=
h
.
readlines
()
a
=
h
.
readlines
()
#读多行
for
i
in
a
:
for
i
in
a
:
wc
=
i
.
split
()
wc
=
i
.
split
()
#将i转为以间隔为分隔元素 成列表
w
=
wc
[
1
:]
w
=
wc
[
1
:]
#去掉第一个元素
sum
=
0
sum
=
0
#和
for
y
in
w
:
for
y
in
w
:
# print(y)
# print(y)
sum
=
sum
+
int
(
y
)
sum
=
sum
+
int
(
y
)
print
(
sum
)
print
(
sum
)
\ 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