{"id":3059,"date":"2022-09-11T19:57:50","date_gmt":"2022-09-11T14:57:50","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=3059"},"modified":"2022-09-11T19:57:52","modified_gmt":"2022-09-11T14:57:52","slug":"7zip-compression-decompression-using-python3-and-py7zr","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/","title":{"rendered":"7Zip Compression\/Decompression Using Python 3 and py7zr"},"content":{"rendered":"\n<p>In this tutorial, you will learn how to use <strong>Python 3<\/strong> and <strong>py7zr<\/strong> to perform <strong>7Zip Compression\/Decompression<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Install py7zr?<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">pip install py7zr<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How to use py7zr in CLI?<\/h2>\n\n\n\n<p>You can run the below-mentioned <strong>py7zr commands<\/strong> according to your specific requirements.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">List archive contents<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr l test.7z<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Extract archive<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr x test.7z<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Extract archive with password<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr x -P test.7z\npassword?: ****<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Create and compress to archive<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr c target.7z test_dir<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Create multi-volume archive<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr c -v 500k target.7z test_dir<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Test archive<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr t test.7z<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Append files to archive<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr a test.7z test_dir<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Show information<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr i<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Show version<\/h2>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">py7zr --version<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Decompression\/Decryption<\/h2>\n\n\n\n<p>Here is a code snippet on how to decompress some files in your application.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n\n&lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'sample.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;mode&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'r'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;extractall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;\/tmp&quot;&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<p>You can also use the &#8216;with&#8217; block because py7zr provides a context manager (with version 0.6 and later).<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'sample.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;mode&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'r'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;z&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;extractall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;\/span&gt;\n\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'target.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'w'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;z&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;writeall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'.\/base_dir'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<p>py7zr also supports extraction of single or selected files by <strong>&#8216;extract(targets=[&#8216;file path&#8217;])&#8217;<\/strong>.<\/p>\n\n\n\n<p><strong>Note:-<\/strong> If you specify only a file but not a parent directory, it will fail.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;re&lt;\/span&gt;\n\n&lt;span class=&quot;n&quot;&gt;filter_pattern&lt;\/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;compile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'&lt;your\/target\/file_and_directories\/regex\/expression&gt;'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'archive.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'r'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;allfiles&lt;\/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;getnames&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;selective_files&lt;\/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;filter_pattern&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;f&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;\/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;allfiles&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;extract&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;targets&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;selective_files&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<p>py7zr supports the extraction of password-protected archives. (with version 0.6 and later)<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'encrypted.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;mode&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'r'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'secret'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;z&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;extractall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Compression\/Encryption<\/h2>\n\n\n\n<p>Here is a code snippet on how to produce an archive.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'target.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'w'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;writeall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'\/path\/to\/base_dir'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'base'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<p>To create an encrypted archive, please enter a password.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'target.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'w'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'secret'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;writeall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'\/path\/to\/base_dir'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'base'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<p>To create an archive with algorithms such as zstandard, you can call a custom filter.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt;\n\n&lt;span class=&quot;n&quot;&gt;my_filters&lt;\/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;\/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;FILTER_ZSTD&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;}]&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;another_filters&lt;\/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;\/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;FILTER_ARM&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;\/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;\/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;id&quot;&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;FILTER_LZMA2&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;preset&quot;&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;}]&lt;\/span&gt;\n&lt;span class=&quot;k&quot;&gt;with&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;py7zr&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;SevenZipFile&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'target.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'w'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;filters&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;my_filter&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;\/span&gt;\n    &lt;span class=&quot;n&quot;&gt;archive&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;writeall&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'\/path\/to\/base_dir'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'base'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;<\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">shutil helper<\/h2>\n\n\n\n<p>py7zr also supports the <code>shutil<\/code> interface.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;span class=&quot;kn&quot;&gt;from&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;py7zr&lt;\/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;pack_7zarchvie&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;unpack_7zarchive&lt;\/span&gt;\n&lt;span class=&quot;kn&quot;&gt;import&lt;\/span&gt; &lt;span class=&quot;nn&quot;&gt;shutil&lt;\/span&gt;\n\n&lt;span class=&quot;c1&quot;&gt;# register file format at first.&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;shutil&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;register_archive_format&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'7zip'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;pack_7zarchive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;description&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'7zip archive'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;shutil&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;register_unpack_format&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'7zip'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;\/span&gt; &lt;span class=&quot;n&quot;&gt;unpack_7zarchive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;\n\n&lt;span class=&quot;c1&quot;&gt;# extraction&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;shutil&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;unpack_archive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'test.7z'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'\/tmp'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;\n\n&lt;span class=&quot;c1&quot;&gt;# compression&lt;\/span&gt;\n&lt;span class=&quot;n&quot;&gt;shutil&lt;\/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;\/span&gt;&lt;span class=&quot;n&quot;&gt;make_archive&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;\/span&gt;&lt;span class=&quot;s1&quot;&gt;'target'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'7zip'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;\/span&gt; &lt;span class=&quot;s1&quot;&gt;'src'&lt;\/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;\/span&gt;<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to use Python 3 and py7zr to perform 7Zip Compression\/Decompression. How to Install py7zr? How to use py7zr in CLI? You can run the below-mentioned py7zr commands according to your specific requirements. List archive contents Extract archive Extract archive with password Create and compress to archive Create multi-volume &#8230; <a title=\"7Zip Compression\/Decompression Using Python 3 and py7zr\" class=\"read-more\" href=\"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/\" aria-label=\"Read more about 7Zip Compression\/Decompression Using Python 3 and py7zr\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":1762,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-3059","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>7Zip Compression\/Decompression Using Python 3 and py7zr<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to use Python 3 and py7zr to perform 7Zip Compression\/Decompression. How to Install py7zr? pip install py7zr How to\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"7Zip Compression\/Decompression Using Python 3 and py7zr\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to use Python 3 and py7zr to perform 7Zip Compression\/Decompression. How to Install py7zr? pip install py7zr How to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-11T14:57:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-11T14:57:52+00:00\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"7Zip Compression\/Decompression Using Python 3 and py7zr","description":"In this tutorial, you will learn how to use Python 3 and py7zr to perform 7Zip Compression\/Decompression. How to Install py7zr? pip install py7zr How to","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/","og_locale":"en_US","og_type":"article","og_title":"7Zip Compression\/Decompression Using Python 3 and py7zr","og_description":"In this tutorial, you will learn how to use Python 3 and py7zr to perform 7Zip Compression\/Decompression. How to Install py7zr? pip install py7zr How to","og_url":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-09-11T14:57:50+00:00","article_modified_time":"2022-09-11T14:57:52+00:00","author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"7Zip Compression\/Decompression Using Python 3 and py7zr","datePublished":"2022-09-11T14:57:50+00:00","dateModified":"2022-09-11T14:57:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/"},"wordCount":201,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/","url":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/","name":"7Zip Compression\/Decompression Using Python 3 and py7zr","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","datePublished":"2022-09-11T14:57:50+00:00","dateModified":"2022-09-11T14:57:52+00:00","description":"In this tutorial, you will learn how to use Python 3 and py7zr to perform 7Zip Compression\/Decompression. How to Install py7zr? pip install py7zr How to","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/02\/default_featured_image.jpg","width":880,"height":495,"caption":"Default Featured Image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/7zip-compression-decompression-using-python3-and-py7zr\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"7Zip Compression\/Decompression Using Python 3 and py7zr"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=3059"}],"version-history":[{"count":2,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3059\/revisions"}],"predecessor-version":[{"id":3061,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3059\/revisions\/3061"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/1762"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=3059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=3059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=3059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}