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

bellcode / lesson13-4

  • 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
Switch branch/tag
  • lesson13-4
  • diy.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    save project · 1df2bfb8
    BellCodeEditor committed 4 years ago
    1df2bfb8
diy.py 474 Bytes
Edit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
g=0
v=""
with open(r'c:\Users\EDZ\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as a:    
    for i in a.readlines():
        i=i.split()
        print(i[0],end=':    ')
        v+=str(i[0])+':  '
        s=0
        for j in i[1:]:
            s += int(j)
        print(s)
        v+=str(s)+'\n'
        g+=s
    print(g)
    v+=str(g)+'\n'
with open(r'c:\Users\EDZ\Documents\lesson13-1\ales_list.txt','w',encoding='utf-8') as f:
    f.write(v)