f=open(r'D:\py\game0227\game.txt')
save=f.read().split()
print(save)
game_times=int(save[0])
min_times=int(save[1])
total_times=int(save[2])
if game_times!=0:
ave_times=float(total_times)/game_times
else:
ave_times=0
print('you have won %d times,and min_times is %d,ave_times is %.2f'(
game_times,min_times,ave_times) )
错误
#Traceback (most recent call last):
File "D:/py/game0227/test.py", line 15, in <module>
game_times,min_times,ave_times) )
TypeError: 'str' object is not callable
作者: TED 时间: 2018-2-28 08:48
按报错信息看 是第15行那个print('string%d and %d and %d' % (1,2,3))的结构,你把中间的%漏掉了作者: 冬天吃冰棍儿 时间: 2018-2-28 14:56
TED 发表于 2018-2-28 08:48
按报错信息看 是第15行那个print('string%d and %d and %d' % (1,2,3))的结构,你把中间的%漏掉了 ...