我尝试使用pickle模块,但出现属性错误?

时间:2020-03-26 18:02:02

标签: python python-3.x

import pickle

text = "Hello world I'm corona virus.I'm coming to the earth."

f = open('text.pck','w')
pickle.dump(text,f)
f.write(text)
f.close()
Traceback (most recent call last):
  File "D:\Python\Python\pickle.py", line 1, in <module>
    import pickle
  File "D:\Python\Python\pickle.py", line 6, in <module>
    pickle.dump(text,f)
AttributeError: module 'pickle' has no attribute 'dump'.

0 个答案:

没有答案