Advertisement
Guest User

Untitled

a guest
Oct 25th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import progressbar
  2. import time
  3.  
  4. import tarfile
  5.  
  6. filepath ="./test/"
  7. tar = tarfile.open("./test.gz")
  8. list = tar.getnames()   # list
  9. # for n in list:
  10. #   tar.extract(n. filepath)
  11. # tar.close()
  12.  
  13. size=len(list)  # int, e.g.127
  14. with progressbar.ProgressBar(
  15.   widgets=[progressbar.SimpleProgress()],
  16.   max_value=size) as bar:
  17.  
  18.   for i in range(size):
  19.     tar.extract(list[i], filepath)
  20.     bar.update(i+1)
  21.   bar.finish()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement