Commit 20bc87f8 by BellCodeEditor

save project

parent 02bc5d69
Showing with 6 additions and 3 deletions
with open(r'c:\Users\admin\Desktop\hhhhhhhh.txt','r',encoding='utf-8') as file: with open(r'c:\Users\admin\Desktop\hhhhhhhh.txt','r',encoding='utf-8') as file:
a=file.readlines() a=file.readlines()
zh=[]
for i in a: for i in a:
#print(type(i)) #print(type(i))
i=i.split() i=i.split()
...@@ -7,5 +8,7 @@ with open(r'c:\Users\admin\Desktop\hhhhhhhh.txt','r',encoding='utf-8') as file: ...@@ -7,5 +8,7 @@ with open(r'c:\Users\admin\Desktop\hhhhhhhh.txt','r',encoding='utf-8') as file:
sun=0 sun=0
for seles in i[1:]: for seles in i[1:]:
sun=sun+int(seles) sun=sun+int(seles)
hhh=i[0]+str(sun) hhh=i[0]+str(sun)+"\n"
print(hhh) zh.append(result)
\ No newline at end of file with open(r'c:\Users\admin\Desktop\zh.txt','a',encoding='utf-8') as file:
file.writelines(zh)
\ No newline at end of file
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