- 帖子
- 9
- 精华
- 0
- 积分
- 34
- 阅读权限
- 10
- 注册时间
- 2018-2-25
- 最后登录
- 2018-3-2
|
本帖最后由 冬天吃冰棍儿 于 2018-2-27 21:46 编辑
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
|
|