-1

I'm using Python 3.4. Writing

csv_f = tarfile.open('C:\\Users\\somefile.gz')

works fine but this

csv_f = tarfile.extract('C:\\Users\\somefile.gz') 

causes the response

AttributeError: 'module' object has no attribute 'extract'

It seems the extract and extractall functions aren't being found in the library. How can that be?

William
  • 59
  • 8

1 Answers1

0

Because they're methods of the object returned by tarfile.open(), not functions in the module itself.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358