Browse Source

Format

pull/46/head
Jure Šorn 5 years ago
parent
commit
14702d3019
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -418,9 +418,9 @@ Format
### Strings
**`'!r'` calls object's [repr()](#class) method, instead of [str()](#class), to get a string.**
```python
{'abcde'!r:<10} # "'abcde' "
{'abcde':.3} # 'abc'
{'abcde'!r:10} # "'abcde' "
{'abcde':10.3} # 'abc '
{'abcde':.3} # 'abc'
```
### Numbers

4
index.html

@ -510,9 +510,9 @@ to_exclusive = &lt;range&gt;.stop
<pre><code class="python language-python hljs">{&lt;el&gt;:.&lt;<span class="hljs-number">10</span>} <span class="hljs-comment"># '&lt;el&gt;......'</span>
{&lt;el&gt;:&lt;<span class="hljs-number">0</span>} <span class="hljs-comment"># '&lt;el&gt;'</span>
</code></pre>
<div><h3 id="strings">Strings</h3><p><strong><code class="python hljs"><span class="hljs-string">'!r'</span></code> calls object's <a href="#class">repr()</a> method, instead of <a href="#class">str()</a>, to get a string.</strong></p><pre><code class="python language-python hljs">{<span class="hljs-string">'abcde'</span>!r:&lt;<span class="hljs-number">10</span>} <span class="hljs-comment"># "'abcde' "</span>
{<span class="hljs-string">'abcde'</span>:<span class="hljs-number">.3</span>} <span class="hljs-comment"># 'abc'</span>
<div><h3 id="strings">Strings</h3><p><strong><code class="python hljs"><span class="hljs-string">'!r'</span></code> calls object's <a href="#class">repr()</a> method, instead of <a href="#class">str()</a>, to get a string.</strong></p><pre><code class="python language-python hljs">{<span class="hljs-string">'abcde'</span>!r:<span class="hljs-number">10</span>} <span class="hljs-comment"># "'abcde' "</span>
{<span class="hljs-string">'abcde'</span>:<span class="hljs-number">10.3</span>} <span class="hljs-comment"># 'abc '</span>
{<span class="hljs-string">'abcde'</span>:<span class="hljs-number">.3</span>} <span class="hljs-comment"># 'abc'</span>
</code></pre></div>

Loading…
Cancel
Save