import picklea = [1, 2, 3]with open('a.pk', 'wb') as f:pickle.dump(a, f)import picklewith open('a.pk', 'rb') as f:a = pickle.load(f)print(a)
# python2使用cpickle, 被python3弃用,直接pickle
import picklea = [1, 2, 3]with open('a.pk', 'wb') as f:pickle.dump(a, f)import picklewith open('a.pk', 'rb') as f:a = pickle.load(f)print(a)
# python2使用cpickle, 被python3弃用,直接pickle
Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:
部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。