0
這是遇到我到目前爲止的代碼錯誤使用「.format」
def Save_Scores():
global score
score=str(score)
file=open("Class{}.txt",'a').format(group)
file.write("\n")
file.write ("Name: "+name+"\n")
file.write("Score: "+score+"/10\n")
file.close()
quiz()
但是我遇到這個錯誤時,函數跑
line 42, in Save_Scores
file=open("Class{}.txt",'a').format(group)
AttributeError: '_io.TextIOWrapper' object has no attribute 'format'
您是不是要找「 」類{} TXT。「 .format(集團)'? – bereal