bz2 解压文件

解压文件,写入另一个文件中
pp = r'C:\Users\xixi\Desktop\ecmf\W_NAFP_C_ECMF_20200101054247_P_C1D01010000010100001.bz2'

with open('xxxxxx.grib', 'wb') as new_file, bz2.BZ2File(pp, 'rb') as file:
    for data in iter(lambda: file.read(100 * 1024), b''):
        new_file.write(data)

 

 

参考: https://blog.csdn.net/bananajia/article/details/52350966

            https://blog.csdn.net/kxjrzyk/article/details/79244312

posted on 2020-12-17 09:24  闹不机米  阅读(626)  评论(0编辑  收藏  举报

导航