序列化:
将变量从内存变成可存储或者是可传输的这个过程我们称之为序列化。
反序列化:
将变量的内容从序列化的对象中重新读入到内存的过程我们称之为反序列化。
例:
dict1 = {"name":"韩梅梅","age":19}
dict1["age"] = 20
with open("demo.txt","w",encoding="utf-8") as f:
f.write(str(dict1)) #序列化
with open("demo.txt","r",encoding="utf-8") as f2:
str1 = f2.read()
dict2 = eval(str1)
print(dict2) #反序列化