■ dump 함수 : 객체 저장하기

----------------------------------------------------------------------------------------------------

import pickle

 

gameDataMap = {

    "player-position" : "N23 E45",

    "pockers"         : ["keys", "pocket knife", "polished stone"],

    "backpack"        : ["rope", "hammer", "apple"],

    "money"           : 158.50

}

 

file = open("d:\\save.dat", "wb")

 

pickle.dump(gameDataMap, file)

 

file.close()

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요