Skip to content

Commit 872d766

Browse files
committed
Add note about external libs for datetimes
1 parent 05f3b3a commit 872d766

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

notebooks/beginner/html/std_lib.html

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11777,7 +11777,7 @@
1177711777
}
1177811778

1177911779
$( document ).ready(function(){
11780-
show=false;
11780+
show=false;
1178111781
$('div.output').hide()
1178211782
});
1178311783
</script>
@@ -11848,11 +11848,11 @@ <h2 id="datetime-for-working-with-dates-and-times"><a href="https://docs.python.
1184811848

1184911849

1185011850
<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
1185611856
</pre>
1185711857
</div>
1185811858
</div>
@@ -11896,8 +11896,8 @@ <h3 id="strftime()"><code>strftime()</code><a class="anchor-link" href="#strftim
1189611896

1189711897

1189811898
<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
1190111901
</pre>
1190211902
</div>
1190311903
</div>
@@ -11984,7 +11984,7 @@ <h3 id="timedelta"><a href="https://docs.python.org/3/library/datetime.html#time
1198411984

1198511985

1198611986
<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
1198811988
tomorrow - now = 1 day, 0:00:00
1198911989
days: 1, seconds: 0
1199011990
total seconds: 86400.0
@@ -12029,8 +12029,6 @@ <h3 id="Working-with-timezones">Working with timezones<a class="anchor-link" hre
1202912029

1203012030
<div class="output_subarea output_stream output_stdout output_text">
1203112031
<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 &#39;pip install --upgrade pip&#39; command.</span>
1203412032
</pre>
1203512033
</div>
1203612034
</div>
@@ -12079,17 +12077,26 @@ <h3 id="Working-with-timezones">Working with timezones<a class="anchor-link" hre
1207912077

1208012078

1208112079
<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
1208612084
</pre>
1208712085
</div>
1208812086
</div>
1208912087

1209012088
</div>
1209112089
</div>
1209212090

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>
1209312100
</div>
1209412101
<div class="cell border-box-sizing text_cell rendered"><div class="prompt input_prompt">
1209512102
</div>
@@ -12184,8 +12191,8 @@ <h3 id="Formatting-log-entries">Formatting log entries<a class="anchor-link" hre
1218412191

1218512192

1218612193
<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
1218912196
</pre>
1219012197
</div>
1219112198
</div>
@@ -12230,8 +12237,8 @@ <h2 id="random-for-random-number-generation"><a href="https://docs.python.org/3/
1223012237

1223112238

1223212239
<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
1223512242
</pre>
1223612243
</div>
1223712244
</div>

notebooks/beginner/std_lib.ipynb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@
145145
"print('New York: {}, tzinfo: {}'.format(ny_now, ny_now.tzinfo))"
146146
]
147147
},
148+
{
149+
"cell_type": "markdown",
150+
"metadata": {},
151+
"source": [
152+
"**NOTE**: If your project uses datetimes heavily, you may want to take a look at external libraries, such as [Pendulum](https://pendulum.eustace.io/docs/) and [Maya](https://github.com/kennethreitz/maya), which make working with datetimes easier for certain use cases."
153+
]
154+
},
148155
{
149156
"cell_type": "markdown",
150157
"metadata": {},

0 commit comments

Comments
 (0)