snipt

Ctrl+h for KB shortcuts

Bash

Disassembler for Python bytecode

1
2
3
4
5
6
$ python -m dis test.py 
  1           0 LOAD_CONST               0 ('Hello world')
              3 PRINT_ITEM          
              4 PRINT_NEWLINE       
              5 LOAD_CONST               1 (None)
              8 RETURN_VALUE        
https://snipt.net/embed/df6e3b37133eb022c48e421227a19f7e/
/raw/df6e3b37133eb022c48e421227a19f7e/
df6e3b37133eb022c48e421227a19f7e
bash
Bash
7
2019-07-19T12:55:29
True
False
False
/api/public/snipt/6881/
disassembler-for-python-bytecode
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$ python -m dis test.py </span><span id="L-2"><a name="L-2"></a> <span class="m">1</span> <span class="m">0</span> LOAD_CONST <span class="m">0</span> <span class="o">(</span><span class="s1">&#39;Hello world&#39;</span><span class="o">)</span> </span><span id="L-3"><a name="L-3"></a> <span class="m">3</span> PRINT_ITEM </span><span id="L-4"><a name="L-4"></a> <span class="m">4</span> PRINT_NEWLINE </span><span id="L-5"><a name="L-5"></a> <span class="m">5</span> LOAD_CONST <span class="m">1</span> <span class="o">(</span>None<span class="o">)</span> </span><span id="L-6"><a name="L-6"></a> <span class="m">8</span> RETURN_VALUE </span></pre></div> </td></tr></table>
bytecode, disassembler, profiling, python

Python

Simple generation of random string in Python

1
2
3
4
import string
import random

print "".join(random.sample(string.letters+string.digits, 8))
https://snipt.net/embed/ac145bb5129e46f730fa7009e98abfb5/
/raw/ac145bb5129e46f730fa7009e98abfb5/
ac145bb5129e46f730fa7009e98abfb5
python
Python
4
2019-07-20T14:28:09
True
False
False
/api/public/snipt/6463/
simple-generation-of-random-string-in-python
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kn">import</span> <span class="nn">string</span> </span><span id="L-2"><a name="L-2"></a><span class="kn">import</span> <span class="nn">random</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="k">print</span> <span class="s2">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">random</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="n">string</span><span class="o">.</span><span class="n">letters</span><span class="o">+</span><span class="n">string</span><span class="o">.</span><span class="n">digits</span><span class="p">,</span> <span class="mi">8</span><span class="p">))</span> </span></pre></div> </td></tr></table>
python, random, strings