我正在尝试使用pickle在mysql中存储一个对象,但无论我做什么,我似乎都无法解开数据。
我的mysql数据库
http://i.imgur.com/xCyZtIO.png
我的mysql连接功能
conn = MySQLdb.connect (host = "localhost", user = "user", passwd = "password", db = 'database', use_unicode=True)
存储数据
cursor.execute('UPDATE matchmaking set `elo` = %s WHERE `token` = %s', (pickle.dumps(Rating()) , y[0] ))
加载数据
cursor.execute('SELECT * FROM matchmaking where `gameid` = %s LIMIT 200', (row[0]))
player1 = pickle.loads(player[x][2])
键错误:'"'
print player[x]
(u'35dc00eeb1fa2a49efcae7d2a8233cef', 1L, '"ccopy_reg\n_reconstructor\np0\n(ctrueskill\nRating\np1\nc_ builtin _\nobject\np2\nNtp3\nRp4\n(dp5\nS\'tau\'\np6\nF0 .35999999999999993\nsS\'pi\'\np7\nF0.0143999999999999998\nsb."', 2L)