• <small id='B8VJ6'></small><noframes id='B8VJ6'>

      1. <legend id='B8VJ6'><style id='B8VJ6'><dir id='B8VJ6'><q id='B8VJ6'></q></dir></style></legend>

        <i id='B8VJ6'><tr id='B8VJ6'><dt id='B8VJ6'><q id='B8VJ6'><span id='B8VJ6'><b id='B8VJ6'><form id='B8VJ6'><ins id='B8VJ6'></ins><ul id='B8VJ6'></ul><sub id='B8VJ6'></sub></form><legend id='B8VJ6'></legend><bdo id='B8VJ6'><pre id='B8VJ6'><center id='B8VJ6'></center></pre></bdo></b><th id='B8VJ6'></th></span></q></dt></tr></i><div id='B8VJ6'><tfoot id='B8VJ6'></tfoot><dl id='B8VJ6'><fieldset id='B8VJ6'></fieldset></dl></div>
          <bdo id='B8VJ6'></bdo><ul id='B8VJ6'></ul>
        <tfoot id='B8VJ6'></tfoot>

        在 Python 中 gzip 文件

        时间:2023-07-21
          <tbody id='MH4JT'></tbody>

        <legend id='MH4JT'><style id='MH4JT'><dir id='MH4JT'><q id='MH4JT'></q></dir></style></legend>

        <tfoot id='MH4JT'></tfoot>

        <small id='MH4JT'></small><noframes id='MH4JT'>

                <bdo id='MH4JT'></bdo><ul id='MH4JT'></ul>

                  <i id='MH4JT'><tr id='MH4JT'><dt id='MH4JT'><q id='MH4JT'><span id='MH4JT'><b id='MH4JT'><form id='MH4JT'><ins id='MH4JT'></ins><ul id='MH4JT'></ul><sub id='MH4JT'></sub></form><legend id='MH4JT'></legend><bdo id='MH4JT'><pre id='MH4JT'><center id='MH4JT'></center></pre></bdo></b><th id='MH4JT'></th></span></q></dt></tr></i><div id='MH4JT'><tfoot id='MH4JT'></tfoot><dl id='MH4JT'><fieldset id='MH4JT'></fieldset></dl></div>
                  本文介绍了在 Python 中 gzip 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想用 Python 压缩一个文件.我正在尝试使用 subprocss.check_call(),但它一直失败并出现错误OSError:[Errno 2] No such file or directory".我在这里尝试的有问题吗?有没有比使用 subprocess.check_call 更好的压缩文件的方法?

                  I want to gzip a file in Python. I am trying to use the subprocss.check_call(), but it keeps failing with the error 'OSError: [Errno 2] No such file or directory'. Is there a problem with what I am trying here? Is there a better way to gzip a file than using subprocess.check_call?

                  from subprocess import check_call
                  
                  def gZipFile(fullFilePath)
                      check_call('gzip ' + fullFilePath)
                  

                  谢谢!!

                  推荐答案

                  试试这个:

                  check_call(['gzip', fullFilePath])
                  

                  根据您对这些文件的数据所做的处理,Skirmantas 的链接到 http://docs.python.org/library/gzip.html 也可能有帮助.请注意页面底部附近的示例.如果您不需要访问数据,或者您的 Python 代码中没有数据,执行 gzip 可能是最简洁的方法,因此您不必在 Python 中处理数据.

                  Depending on what you're doing with the data of these files, Skirmantas's link to http://docs.python.org/library/gzip.html may also be helpful. Note the examples near the bottom of the page. If you aren't needing to access the data, or don't have the data already in your Python code, executing gzip may be the cleanest way to do it so you don't have to handle the data in Python.

                  这篇关于在 Python 中 gzip 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:新手 python 子进程:“写入错误:管道损坏" 下一篇:如何使用python将本地文件推送到github?(或通过 Python 发布提交)

                  相关文章

                  <tfoot id='ueeXH'></tfoot>

                1. <small id='ueeXH'></small><noframes id='ueeXH'>

                    <bdo id='ueeXH'></bdo><ul id='ueeXH'></ul>

                    <legend id='ueeXH'><style id='ueeXH'><dir id='ueeXH'><q id='ueeXH'></q></dir></style></legend>

                    1. <i id='ueeXH'><tr id='ueeXH'><dt id='ueeXH'><q id='ueeXH'><span id='ueeXH'><b id='ueeXH'><form id='ueeXH'><ins id='ueeXH'></ins><ul id='ueeXH'></ul><sub id='ueeXH'></sub></form><legend id='ueeXH'></legend><bdo id='ueeXH'><pre id='ueeXH'><center id='ueeXH'></center></pre></bdo></b><th id='ueeXH'></th></span></q></dt></tr></i><div id='ueeXH'><tfoot id='ueeXH'></tfoot><dl id='ueeXH'><fieldset id='ueeXH'></fieldset></dl></div>