|
11777 | 11777 | } |
11778 | 11778 |
|
11779 | 11779 | $( document ).ready(function(){ |
11780 | | - show=false; |
| 11780 | +show=false; |
11781 | 11781 | $('div.output').hide() |
11782 | 11782 | }); |
11783 | 11783 | </script> |
@@ -11848,11 +11848,11 @@ <h2 id="datetime-for-working-with-dates-and-times"><a href="https://docs.python. |
11848 | 11848 |
|
11849 | 11849 |
|
11850 | 11850 | <div class="output_subarea output_stream output_stdout output_text"> |
11851 | | -<pre>local now: 2018-05-05 09:21:55.642865 |
11852 | | -utc now: 2018-05-05 07:21:55.643048 |
11853 | | -2018 5 5 9 21 55 |
11854 | | -date: 2018-05-05 |
11855 | | -time: 09:21:55.642865 |
| 11851 | +<pre>local now: 2018-07-08 12:07:23.620463 |
| 11852 | +utc now: 2018-07-08 10:07:23.620661 |
| 11853 | +2018 7 8 12 7 23 |
| 11854 | +date: 2018-07-08 |
| 11855 | +time: 12:07:23.620463 |
11856 | 11856 | </pre> |
11857 | 11857 | </div> |
11858 | 11858 | </div> |
@@ -11896,8 +11896,8 @@ <h3 id="strftime()"><code>strftime()</code><a class="anchor-link" href="#strftim |
11896 | 11896 |
|
11897 | 11897 |
|
11898 | 11898 | <div class="output_subarea output_stream output_stdout output_text"> |
11899 | | -<pre>2018/05/05-09:21:55 |
11900 | | -date: 2018-05-05 time:09:21:55 |
| 11899 | +<pre>2018/07/08-12:07:23 |
| 11900 | +date: 2018-07-08 time:12:07:23 |
11901 | 11901 | </pre> |
11902 | 11902 | </div> |
11903 | 11903 | </div> |
@@ -11984,7 +11984,7 @@ <h3 id="timedelta"><a href="https://docs.python.org/3/library/datetime.html#time |
11984 | 11984 |
|
11985 | 11985 |
|
11986 | 11986 | <div class="output_subarea output_stream output_stdout output_text"> |
11987 | | -<pre>tomorrow this time: 2018-05-06 09:21:55.642865 |
| 11987 | +<pre>tomorrow this time: 2018-07-09 12:07:23.620463 |
11988 | 11988 | tomorrow - now = 1 day, 0:00:00 |
11989 | 11989 | days: 1, seconds: 0 |
11990 | 11990 | total seconds: 86400.0 |
@@ -12029,8 +12029,6 @@ <h3 id="Working-with-timezones">Working with timezones<a class="anchor-link" hre |
12029 | 12029 |
|
12030 | 12030 | <div class="output_subarea output_stream output_stdout output_text"> |
12031 | 12031 | <pre>Requirement already satisfied: pytz in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (2018.4) |
12032 | | -<span class="ansi-yellow-fg">You are using pip version 10.0.0, however version 10.0.1 is available. |
12033 | | -You should consider upgrading via the 'pip install --upgrade pip' command.</span> |
12034 | 12032 | </pre> |
12035 | 12033 | </div> |
12036 | 12034 | </div> |
@@ -12079,17 +12077,26 @@ <h3 id="Working-with-timezones">Working with timezones<a class="anchor-link" hre |
12079 | 12077 |
|
12080 | 12078 |
|
12081 | 12079 | <div class="output_subarea output_stream output_stdout output_text"> |
12082 | | -<pre>naive utc now: 2018-05-05 07:21:56.479642, tzinfo: None |
12083 | | -utc now: 2018-05-05 07:21:56.479642+00:00, tzinfo: UTC |
12084 | | -Paris: 2018-05-05 09:21:56.479642+02:00, tzinfo: Europe/Paris |
12085 | | -New York: 2018-05-05 03:21:56.479642-04:00, tzinfo: America/New_York |
| 12080 | +<pre>naive utc now: 2018-07-08 10:07:24.490800, tzinfo: None |
| 12081 | +utc now: 2018-07-08 10:07:24.490800+00:00, tzinfo: UTC |
| 12082 | +Paris: 2018-07-08 12:07:24.490800+02:00, tzinfo: Europe/Paris |
| 12083 | +New York: 2018-07-08 06:07:24.490800-04:00, tzinfo: America/New_York |
12086 | 12084 | </pre> |
12087 | 12085 | </div> |
12088 | 12086 | </div> |
12089 | 12087 |
|
12090 | 12088 | </div> |
12091 | 12089 | </div> |
12092 | 12090 |
|
| 12091 | +</div> |
| 12092 | +<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt"> |
| 12093 | +</div> |
| 12094 | +<div class="inner_cell"> |
| 12095 | +<div class="text_cell_render border-box-sizing rendered_html"> |
| 12096 | +<p><strong>NOTE</strong>: If your project uses datetimes heavily, you may want to take a look at external libraries, such as <a href="https://pendulum.eustace.io/docs/">Pendulum</a> and <a href="https://github.com/kennethreitz/maya">Maya</a>, which make working with datetimes easier for certain use cases.</p> |
| 12097 | + |
| 12098 | +</div> |
| 12099 | +</div> |
12093 | 12100 | </div> |
12094 | 12101 | <div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt"> |
12095 | 12102 | </div> |
@@ -12184,8 +12191,8 @@ <h3 id="Formatting-log-entries">Formatting log entries<a class="anchor-link" hre |
12184 | 12191 |
|
12185 | 12192 |
|
12186 | 12193 | <div class="output_subarea output_stream output_stderr output_text"> |
12187 | | -<pre>2018-05-05 09:21:56,527 | MyLogger | WARNING | Something bad is going to happen |
12188 | | -2018-05-05 09:21:56,528 | MyLogger | ERROR | Uups, it already happened |
| 12194 | +<pre>2018-07-08 12:07:24,540 | MyLogger | WARNING | Something bad is going to happen |
| 12195 | +2018-07-08 12:07:24,541 | MyLogger | ERROR | Uups, it already happened |
12189 | 12196 | </pre> |
12190 | 12197 | </div> |
12191 | 12198 | </div> |
@@ -12230,8 +12237,8 @@ <h2 id="random-for-random-number-generation"><a href="https://docs.python.org/3/ |
12230 | 12237 |
|
12231 | 12238 |
|
12232 | 12239 | <div class="output_subarea output_stream output_stdout output_text"> |
12233 | | -<pre>random integer between 1-100: 68 |
12234 | | -random float between 0-1: 0.5799292152023026 |
| 12240 | +<pre>random integer between 1-100: 35 |
| 12241 | +random float between 0-1: 0.09367732583402133 |
12235 | 12242 | </pre> |
12236 | 12243 | </div> |
12237 | 12244 | </div> |
|
0 commit comments