Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson13-5

  • This project
    • Loading...
  • Sign in
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 c1cb17e0 authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 9826f0ff
Hide whitespace changes
Inline Side-by-side
Showing with 19 additions and 5 deletions
  • diy.py
  • sales_list.txt
diy.py
View file @ c1cb17e0
with open(r'c:\Users\admin\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')as file1: with open(r'c:\Users\admin\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')as file1:
first=file1.readlines() first=file1.readlines()
liebiao=[]
for i in first: for i in first:
a=i.split() a=i.split()
sum1=0 sum1=0
for i in a[1:]: for i in a[1:]:
sum1=sum1+int(i) sum1=sum1+int(i)
new_sum=a[0]+str(sum1) new_sum=a[0]+str(sum1)+'\n'
print(new_sum) liebiao.append(new_sum)
\ No newline at end of file with open(r'c:\Users\admin\Documents\lesson13-5\sales_list.txt','a',encoding='utf-8')as file1:
file1.writelines(liebiao)
\ No newline at end of file
This diff is collapsed. Click to expand it.
sales_list.txt
View file @ c1cb17e0
...@@ -10,4 +10,16 @@ ...@@ -10,4 +10,16 @@
刘若若 11 11 13 11 20 15 13 29 24 刘若若 11 11 13 11 20 15 13 29 24
刘阳 11 15 22 11 23 26 22 15 17 52 12 刘阳 11 15 22 11 23 26 22 15 17 52 12
王胜男 27 15 15 26 13 12 15 王胜男 27 15 15 26 13 12 15
王娇 12 11 12 12 15 35 23 11 王娇 12 11 12 12 15 35 23 11悟空348
\ No newline at end of file 诺依380
小贝182
李丽201
宋扬107
王明245
李强164
孙小白222
苏琪137
刘若若147
刘阳226
王胜男123
王娇131
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment