30/09/2018, 19:31
Lỗi TypeError: 'module' object is not callable khi dùng zipfile
import zipfile
def giainen():
tenfile= 'test111.zip'
zip_arc = zipfile(tenfile)
zip_arc.setpassword('123456')
zip_arc.extract('test111.7z')
zip_arc.close()
giainen()
khi chạy thì nó báo lỗi thế này , làm sao để khắc phục ạ ?
C:UsersHeoAppDataLocalProgramsPythonPython35-32python.exe “E:/Google Drive/My pj/Python/test23/main.py”
Traceback (most recent call last):
File “E:/Google Drive/My pj/Python/test23/main.py”, line 11, in
giainen()
File “E:/Google Drive/My pj/Python/test23/main.py”, line 6, in giainen
zip_arc = zipfile(tenfile)
TypeError: ‘module’ object is not callable
Process finished with exit code 1
Bài liên quan
FYI: https://docs.python.org/3/library/zipfile.html
Bạn gọi nhầm tên module rồi
thanks , mày mò hoài không ra T_T