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
e89e59c3
authored
Nov 23, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
dd82b84c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
29 deletions
diy.py
p.py
sales_list.txt
diy.py
deleted
100644 → 0
View file @
dd82b84c
file
=
open
(
r'c:\Users\makcoo\Documents\lesson13-1\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
a
=
file
.
readlines
()
print
(
a
)
final_sum
=
[]
for
i
in
a
:
data
=
i
.
split
()
new_data
=
data
[
1
:]
total
=
0
for
h
in
new_data
:
total
=
total
+
int
(
h
)
result
=
data
[
0
]
+
str
(
total
)
+
'/n'
final_sum
.
append
(
result
)
file
=
open
(
r'c:\Users\makcoo\Documents\lesson13-1\sales_list.txt'
,
'w'
,
encoding
=
'utf-8'
)
file
.
writelines
(
final_sum
)
file
=
open
(
r'c:\Users\makcoo\Documents\lesson13-1\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
k
=
file
.
read
()
print
(
k
)
p.py
0 → 100644
View file @
e89e59c3
pp
=
open
(
r'c:\Users\makcoo\Documents\lesson13-1\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
l
=
pp
.
readlines
()
for
i
in
l
:
print
(
i
)
new_i
=
i
.
split
()
print
(
new_i
[
1
:])
sum
=
0
for
sales
in
new
[
1
:]:
sum
=
sum
+
sales
hh
=
enco
[
0
]
+
str
(
sum
)
file
=
open
(
r'c:\Users\makcoo\Documents\lesson13-1\sales_list.txt'
,
'w'
,
encoding
=
'utf-8)
file.writelines(stion_sum)
sales_list.txt
View file @
e89e59c3
胡168/n0/n0/n
悟空 12 34 16 89
\ No newline at end of file
小贝 78 90 67 45
三眼 21 36 48 59
哪吒 77 22 66 88
\ 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