從文件讀取保存的信息在python中的操作
提問人:楊紫紅發(fā)布時(shí)間:2020-11-19
>>> load_file = open('save.dat', 'rb')
>>> loaded_game_data = pickle.load(load_file)
>>> load_file.close()
>>> print(loaded_game_data)
{'money': 158.5, 'backpack': ['rope', 'hammer', 'apple'],
'player-position': 'N23 E45', 'pockets': ['keys', 'pocket knife',
'polished stone']}
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評論>>