I am trying to serialize an array in python to insert it into a MySQL database ... I am trying to use the pickle.dump () method, but it returns a byte ... what can I use? thank!!
(I work on python 3)
You can try using json to turn it into a string, for example:
import json v = [1, 2, 4] s = json.dumps(v)
Pickle is binary serialization, so you get a byte string.
Pros:
Con's:
JSON , Python. ASCII, . con , , , dicts. , datetime .
Doesn't MySQL allow you to store these pickled bytes in blob ?
... or maybe just
str([1,2,4])
(if you do not need data in json format)