Commit 90290fbc by BellCodeEditor

save project

parent 0cc37ad4
Showing with 26 additions and 0 deletions
a=['cnm\n','nmd\n']
with open(r'c:\Users\ASUS\Desktop\新建文本文档 (2).txt','a',encoding='utf-8')as f:
f.writelines(a)
\ No newline at end of file
class Hero():
def __init__(self):
self.HP=300
self.level=1
yase=Hero()
print(yase.HP)
with open(r'c:\Users\ASUS\Desktop\sales_list.txt','r',encoding='utf-8')as f:
a=f.readlines()
z=[]
for i in a:
d=i.split()
sum=0
for j in d[1:]:
sum=sum+int(j)
cnm=d[0]
cnm=cnm+str(sum)+'\n'
z.append(cnm)
print(z)
with open(r'c:\Users\ASUS\Desktop\新建文本文档 (2).txt','a',encoding='utf-8')as mmmm:
mmmm.writelines(z)
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