Advertisement
Fhernd

manipulacion-archivos-compresos.py

Jul 6th, 2018
1,428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import gzip
  2. import bz2
  3.  
  4. # Descompresión:
  5. with gzip.open('fibonaccis-2.tar.gz', 'rt') as f:
  6.     contenido = f.read()
  7.  
  8.     print (contenido)
  9.  
  10. with bz2.open('fibonaccis-2.tar.bz2', 'rt') as f:
  11.     contenido = f.read()
  12.  
  13.     print(contenido)
  14.  
  15.  
  16. # Compresión:
  17. with gzip.open('fibonaccis-2.bz', 'wt') as f:
  18.     f.write('Python es amazing!')
  19.  
  20. with bz2.open('fibonaccis-2.bz2', 'wt') as f:
  21.     f.write('Python es tremendo!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement