Fhernd icon

manipulacion-archivos-compresos.py

Fhernd | PRO | 07/06/18 01:30:26 PM UTC | 0 ⭐ | 2279 👁️ | Never ⏰ | []
Python |

430 B

|

None

|

0 👍

/

0 👎

import gzip
import bz2
 
# Descompresión:
with gzip.open('fibonaccis-2.tar.gz', 'rt') as f:
    contenido = f.read()
 
    print (contenido)
 
with bz2.open('fibonaccis-2.tar.bz2', 'rt') as f:
    contenido = f.read()
 
    print(contenido)
 
 
# Compresión:
with gzip.open('fibonaccis-2.bz', 'wt') as f:
    f.write('Python es amazing!')
 
with bz2.open('fibonaccis-2.bz2', 'wt') as f:
    f.write('Python es tremendo!')

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎