<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                > python3使用tarfile 解壓`.tar`文件時報錯:file could not be opened successfully ``` Administrator@WIN-6CLR30UNKKF MINGW64 /e/data/ $ ls 05.tar ``` **對/e/data/05.tar進行解壓** ``` import tarfile tar = tarfile.TarFile('E:\\data\05.tar') tar.extractall() tar.close() // 執行后,顯示報錯 (venv) E:\phpstudy\PHPTutorial\WWW\py>python unzip.py Traceback (most recent call last): File "unzip.py", line 84, in <module> un_tar() File "unzip.py", line 17, in un_tar tar = tarfile.open("E:\\data\\_05.tar", "r:*") File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\tarfile.py", line 1580, in open raise ReadError("file could not be opened successfully") tarfile.ReadError: file could not be opened successfully ``` **報錯原因** 1. 文件不存在或路徑不正確:請確保您指定的文件路徑是正確的,并且文件確實存在于該路徑中。 2. 文件權限問題:請確保您有足夠的權限來讀取該文件。您可以嘗試使用 sudo 命令以管理員身份運行您的 Python 腳本。 3. 文件格式問題:請確保您的 tar 歸檔文件是有效的,并且它的格式是 tar 格式。如果您的文件是使用其他壓縮格式(如 gzip 或 bzip2)壓縮的,請先解壓縮該文件,然后再嘗試使用 tarfile 模塊打開它。 6. 文件損壞:如果您的 tar 歸檔文件已損壞,則可能無法成功打開。您可以嘗試使用其他工具(如 tar 命令)打開該文件,以確定文件是否已損壞。 **解決:** 1. 檢查文件類型,發現該文件并不是tar類型,而是7-zip類型文件,因此需要使用7-zip方式進行解壓 ``` Administrator@WIN-6CLR30UNKKF MINGW64 /e/data/ $ ls 05.tar Administrator@WIN-6CLR30UNKKF MINGW64 /e/data/ $ file 05.tar 05.tar: 7-zip archive data, version 0.4 ``` 2. Python可以使用py7zr庫對7-zip類型文件進行操作,在使用之前,需要先安裝py7zr庫 ``` pip install brotlicffi pip install bcj-cffi pip install py7zr ``` 3. 實現 ``` import py7zr arch = py7zr.SevenZipFile("E:/data/05.tar", mode="r", password="1234") arch.extractall(path="E:/data") arch.close() ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看