import pickle r=range(10) s=pickle.dumps(r) print (pickle.loads(s))