CkPython
CkPython
bz2 Compress File
Compress a file to the bz2 file format.Chilkat CkPython Downloads
import sys
import chilkat
success = False
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
bz2 = chilkat.CkBz2()
# Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
success = bz2.CompressFile("qa_data/hamlet.xml","qa_output/hamlet.bz2")
if (success != True):
print(bz2.lastErrorText())
sys.exit()
print("Success.")