Commit f6ba2967 by BellCodeEditor

save project

parent 7b29420e
Showing with 27 additions and 1 deletions
class Hero:
def __init__(self):
self.level = 1
self.hp = 100
self.attack = 100
yase = Hero()
\ No newline at end of file
with open(r"C:\Users\pc\Desktop\123\成绩.txt","r",encoding="utf-8") as file:
a=file.readlines()
g=[]
for i in a:
c=i.split()
sum=0
for sales in c[1:]:
sum=sum+int(sales)
result=c[0]+str(sum)+'\n'
g.append(result)
print(result)
with open(r"c:\Users\pc\Desktop\123\新建文本文档.txt","a",encoding="utf-8") as file:
file.writelines(g)
\ No newline at end of file
with open()
\ No newline at end of file
-- "a/\346\210\220\347\273\251" with
with
\ 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