我正在尝试使用pickle为我的第一个基本游戏创建一个保存/加载功能,但我收到了错误。
我的代码是
def load():
with open('save_game.dat', 'wb') as f:
player_money,weed = pickle.load
我的追溯是
Traceback (most recent call last):
File "<string>", line 301, in runcode
File "<interactive input>", line 1, in <module>
File "C:\Users\Jake\Pictures\Documents\Blue Coat\Compooting\Weed Game.py", line 23, in load
player_money,weed = pickle.load
TypeError: 'builtin_function_or_method' object is not iterable
我将代码更改为包含(f)但我仍然收到此错误
Traceback (most recent call last):
File "<string>", line 301, in runcode
File "<interactive input>", line 1, in <module>
File "C:\Users\Jake\Pictures\Documents\Blue Coat\Compooting\Weed Game.py", line 23, in load
player_money,weed = pickle.load(f)
io.UnsupportedOperation: read