Commit 94475114 by BellCodeEditor

auto save

parent eaccf396
Showing with 8 additions and 14 deletions
final_sum=[] class Hero:
with open(r"C:\Users\Administrator\Desktop\新建文件夹\新建文本文档.txt",'r',encoding='utf-8') as file: def __init__(self):
a=file.readlines() self.level=1
self.hp=300
for i in a: self.attack=20
data=i.split() yase=Hero()
sum=0 print(yase.up)
for sales in data[1:]: \ No newline at end of file
sum=sum+int(sales)
result=data[0]+str(sum)+'\n'
final_sum.append(result)
with open(r"C:\Users\Administrator\Desktop\新建文件夹\新建文本文档.txt",'w',encoding='utf-8') as file:
file.writelines(final_sum)
\ 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