Browse Source

Format

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

2
README.md

@ -408,7 +408,7 @@ Format
```
### Strings
**`'!r'` calls object's repr() method, instead of format(), to get a string.**
**`'!r'` calls object's repr() method, instead of str(), to get a string.**
```python
{'abcde'!r:<10} # "'abcde' "
{'abcde':.3} # 'abc'

2
index.html

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

Loading…
Cancel
Save