You should use modules like pickle or marshal to serialize and load your datas...
I really agree with jice, but keep in mind the Pickle module shouldn't be used for anything that would requires good security, theres a good amount of exploitable loop holes that will most likely never be fixed, and are extremely easy to exploit.