|
54 | 54 |
|
55 | 55 | <body> |
56 | 56 | <header> |
57 | | - <aside>July 24, 2022</aside> |
| 57 | + <aside>July 25, 2022</aside> |
58 | 58 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
59 | 59 | </header> |
60 | 60 |
|
|
528 | 528 | </code></pre></div> |
529 | 529 |
|
530 | 530 |
|
531 | | -<div><h3 id="constructors">Constructors</h3><pre><code class="python language-python apache hljs"><D> = date(year, month, day) |
532 | | -<T> = time(hour=<span class="hljs-number">0</span>, minute=<span class="hljs-number">0</span>, second=<span class="hljs-number">0</span>, microsecond=<span class="hljs-number">0</span>, tzinfo=<span class="hljs-keyword">None</span>, fold=<span class="hljs-number">0</span>) |
533 | | -<DT> = datetime(year, month, day, hour=<span class="hljs-number">0</span>, minute=<span class="hljs-number">0</span>, second=<span class="hljs-number">0</span>, ...) |
534 | | -<TD> = timedelta(weeks=<span class="hljs-number">0</span>, days=<span class="hljs-number">0</span>, hours=<span class="hljs-number">0</span>, minutes=<span class="hljs-number">0</span>, seconds=<span class="hljs-number">0</span>, ...) |
| 531 | +<div><h3 id="constructors">Constructors</h3><pre><code class="python language-python apache hljs"><D> = date(year, month, day) <span class="hljs-comment"># Only accepts valid dates from 1 to 9999 AD.</span> |
| 532 | +<T> = time(hour=<span class="hljs-number">0</span>, minute=<span class="hljs-number">0</span>, second=<span class="hljs-number">0</span>) <span class="hljs-comment"># Also: `microsecond=0, tzinfo=None, fold=0`.</span> |
| 533 | +<DT> = datetime(year, month, day, hour=<span class="hljs-number">0</span>) <span class="hljs-comment"># Also: `minute=0, second=0, microsecond=0, …`.</span> |
| 534 | +<TD> = timedelta(weeks=<span class="hljs-number">0</span>, days=<span class="hljs-number">0</span>, hours=<span class="hljs-number">0</span>) <span class="hljs-comment"># Also: `minutes=0, seconds=0, microsecond=0`.</span> |
535 | 535 | </code></pre></div> |
536 | 536 |
|
537 | 537 | <ul> |
|
565 | 565 | <li><strong>ISO strings come in following forms: <code class="python hljs"><span class="hljs-string">'YYYY-MM-DD'</span></code>, <code class="python hljs"><span class="hljs-string">'HH:MM:SS.mmmuuu[±HH:MM]'</span></code>, or both separated by an arbitrary character. All parts following hours are optional.</strong></li> |
566 | 566 | <li><strong>Python uses the Unix Epoch: <code class="python hljs"><span class="hljs-string">'1970-01-01 00:00 UTC'</span></code>, <code class="python hljs"><span class="hljs-string">'1970-01-01 01:00 CET'</span></code>, …</strong></li> |
567 | 567 | </ul> |
568 | | -<div><h3 id="decode">Decode</h3><pre><code class="python language-python hljs"><str> = <D/T/DT>.isoformat(sep=<span class="hljs-string">'T'</span>) <span class="hljs-comment"># Also timespec='auto/hours/minutes/seconds/…'.</span> |
| 568 | +<div><h3 id="decode">Decode</h3><pre><code class="python language-python hljs"><str> = <D/T/DT>.isoformat(sep=<span class="hljs-string">'T'</span>) <span class="hljs-comment"># Also: `timespec='auto/hours/minutes/seconds/…'`.</span> |
569 | 569 | <str> = <D/T/DT>.strftime(<span class="hljs-string">'<format>'</span>) <span class="hljs-comment"># Custom string representation.</span> |
570 | 570 | <int> = <D/DT>.toordinal() <span class="hljs-comment"># Days since Gregorian NYE 1, ignoring time and tz.</span> |
571 | 571 | <float> = <DTn>.timestamp() <span class="hljs-comment"># Seconds since the Epoch, from DTn in local tz.</span> |
@@ -2274,11 +2274,11 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2274 | 2274 | </code></pre></div> |
2275 | 2275 |
|
2276 | 2276 | <pre><code class="python language-python hljs"><ImageDraw>.point((x, y)) <span class="hljs-comment"># Truncates floats into ints.</span> |
2277 | | -<ImageDraw>.line((x1, y1, x2, y2 [, ...])) <span class="hljs-comment"># To get anti-aliasing use images's resize().</span> |
| 2277 | +<ImageDraw>.line((x1, y1, x2, y2 [, ...])) <span class="hljs-comment"># To get anti-aliasing use Image's resize().</span> |
2278 | 2278 | <ImageDraw>.arc((x1, y1, x2, y2), deg1, deg2) <span class="hljs-comment"># Always draws in clockwise direction.</span> |
2279 | | -<ImageDraw>.rectangle((x1, y1, x2, y2)) <span class="hljs-comment"># To rotate use image's rotate() and paste().</span> |
2280 | | -<ImageDraw>.polygon((x1, y1, x2, y2, ...)) <span class="hljs-comment"># Last and first point get connected.</span> |
2281 | | -<ImageDraw>.ellipse((x1, y1, x2, y2)) <span class="hljs-comment"># To rotate use image's rotate() and paste().</span> |
| 2279 | +<ImageDraw>.rectangle((x1, y1, x2, y2)) <span class="hljs-comment"># To rotate use Image's rotate() and paste().</span> |
| 2280 | +<ImageDraw>.polygon((x1, y1, x2, y2, ...)) <span class="hljs-comment"># Last point gets connected to the first.</span> |
| 2281 | +<ImageDraw>.ellipse((x1, y1, x2, y2)) <span class="hljs-comment"># To rotate use Image's rotate() and paste().</span> |
2282 | 2282 | </code></pre> |
2283 | 2283 | <ul> |
2284 | 2284 | <li><strong>Use <code class="python hljs"><span class="hljs-string">'fill=<color>'</span></code> to set the primary color.</strong></li> |
@@ -2905,7 +2905,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2905 | 2905 |
|
2906 | 2906 |
|
2907 | 2907 | <footer> |
2908 | | - <aside>July 24, 2022</aside> |
| 2908 | + <aside>July 25, 2022</aside> |
2909 | 2909 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
2910 | 2910 | </footer> |
2911 | 2911 |
|
|
0 commit comments