Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson13-4
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
3763df7e
authored
Mar 11, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
57b5dc94
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
15 deletions
1.py
diy.py
new_sales_list.txt
sales_list.txt
1.py
0 → 100644
View file @
3763df7e
with
open
(
r'c:\Users\55428\Documents\lesson13-4\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
ji
:
ij
=
ji
.
readlines
()
jiji
=
[]
for
i
in
ij
:
kun
=
i
.
split
()
sub
=
0
for
lanqiu
in
kun
[
1
:]:
sub
=
sub
+
int
(
lanqiu
)
j
=
kun
[
0
]
+
str
(
sub
)
jiji
.
append
(
j
)
with
open
(
r'c:\Users\55428\Documents\lesson13-4\sales_list.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
ji
:
ji
.
writelines
(
jiji
)
diy.py
View file @
3763df7e
with
open
(
r'c:\Users\55428\Documents\lesson13-3\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
ji
:
with
open
(
r'c:\Users\55428\Documents\lesson13-3\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
ji
:
ij
=
ji
.
readlines
()
ij
=
ji
.
readlines
()
jiji
=
[]
#
jiji=[]
for
i
in
ij
:
for
i
in
ij
:
kun
=
i
.
split
()
print
(
i
)
sub
=
0
# kun=i.split()
for
lanqiu
in
kun
[
1
:]:
# sub=0
sub
=
sub
+
int
(
lanqiu
)
# for lanqiu in kun[1:]:
j
=
kun
[
0
]
+
str
(
sub
)
+
'
\n
'
# sub=sub+int(lanqiu)
jiji
.
append
(
j
)
# print(sub)
with
open
(
r'c:\Users\55428\Documents\lesson13-3\sales_list.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
ji
:
# j=kun[0]+str(sub)
ji
.
writelines
(
jiji
)
# print(j)
with
open
(
r'c:\Users\55428\Documents\lesson13-3\sales_list.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
ji
:
# jiji.append(j)
b
=
ji
.
read
()
# with open (r'c:\Users\55428\Documents\lesson13-3\sales_list.txt','a',encoding='utf-8')as ji:
print
(
b
)
# ji.writelines(jiji)
\ No newline at end of file
new_sales_list.txt
0 → 100644
View file @
3763df7e
光头强164小白222
\ No newline at end of file
sales_list.txt
View file @
3763df7e
光头强 12 12 11 15 11 13 25 26 11 13 15
光头强 12 12 11 15 11 13 25 26 11 13 15
小白 25 26 12 15 27 30 48 39
小白 25 26 12 15 27 30 48 39 光头强164小白222
\ No newline at end of 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