Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Python 3.4。写作
csv_f = tarfile.open('C:\\Users\\somefile.gz')
工作正常,但这
csv_f = tarfile.extract('C:\\Users\\somefile.gz')
引起反应
AttributeError: 'module' object has no attribute 'extract'
似乎在库中找不到 extract 和 extractall 函数。怎么可能?
因为它们是由返回的对象的方法tarfile.open(),而不是模块本身的函数。
tarfile.open()