Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Python

Python: Unzipping files that are flying in through a pipe

# source at serverfault.co: http://va.mu/WEFT
alias unzip-stream="python -c \"import zipfile,sys,StringIO;zipfile.ZipFile(StringIO.StringIO(sys.stdin.read())).extractall(sys.argv[1] if len(sys.argv) == 2 else '.')\""
https://snipt.net/embed/d20428459ad0a35baa7651c1476bb27d/
https://snipt.net/raw/d20428459ad0a35baa7651c1476bb27d/
d20428459ad0a35baa7651c1476bb27d
python
Python
2
2016-12-03T19:11:56
True
False
False
/api/public/snipt/42675/
python-unzip-stream-alias
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># source at serverfault.co: http://va.mu/WEFT</span> </span><span id="L-2"><a name="L-2"></a><span class="n">alias</span> <span class="n">unzip</span><span class="o">-</span><span class="n">stream</span><span class="o">=</span><span class="s2">&quot;python -c </span><span class="se">\&quot;</span><span class="s2">import zipfile,sys,StringIO;zipfile.ZipFile(StringIO.StringIO(sys.stdin.read())).extractall(sys.argv[1] if len(sys.argv) == 2 else &#39;.&#39;)</span><span class="se">\&quot;</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
alias, bash, bashrc, python, unzip
Copyrighted, illegal, or inappropriate content? Email [email protected].