Skip to content

Commit d26a83f

Browse files
committed
Bin and hex functions
1 parent b785fc1 commit d26a83f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ String
286286
<list> = textwrap.wrap(<str>, width) # Nicely breaks string into lines.
287287
```
288288

289+
```python
290+
<str> = bin(<int>) # Binary representation starting with '0b'.
291+
<str> = hex(<int>) # Hexadecimal representation starting with '0x'.
292+
```
293+
289294
### Char
290295
```python
291296
<str> = chr(<int>) # Converts int to unicode char.

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ <h2 id="string"><a href="#string" name="string">#</a>String</h2>
389389
<pre><code class="python language-python hljs">&lt;bool&gt; = &lt;str&gt;.isnumeric() <span class="hljs-comment"># True if str contains only numeric characters.</span>
390390
&lt;list&gt; = textwrap.wrap(&lt;str&gt;, width) <span class="hljs-comment"># Nicely breaks string into lines.</span>
391391
</code></pre>
392+
<pre><code class="python language-python hljs">&lt;str&gt; = bin(&lt;int&gt;) <span class="hljs-comment"># Binary representation starting with '0b'.</span>
393+
&lt;str&gt; = hex(&lt;int&gt;) <span class="hljs-comment"># Hexadecimal representation starting with '0x'.</span>
394+
</code></pre>
392395
<h3 id="char">Char</h3>
393396
<pre><code class="python language-python hljs">&lt;str&gt; = chr(&lt;int&gt;) <span class="hljs-comment"># Converts int to unicode char.</span>
394397
&lt;int&gt; = ord(&lt;str&gt;) <span class="hljs-comment"># Converts unicode char to int.</span>

0 commit comments

Comments
 (0)