8000 Use ZoneInfo from the Standard Library · jerry-git/learn-python3@d3633a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3633a0

Browse files
committed
Use ZoneInfo from the Standard Library
1 parent 3e497ee commit d3633a0

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

notebooks/beginner/exercises/15_std_lib1_exercise.ipynb

Lines changed: 4 additions & 16 deletions
< 8000 /div>
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": null,
6-
"metadata": {},
7-
"outputs": [],
8-
"source": [
9-
"# pytz will be needed in the exercise\n",
10-
"import sys\n",
11-
"\n",
12-
"!{sys.executable} -m pip install pytz"
13-
]
14-
},
153
{
164
"cell_type": "markdown",
175
"metadata": {},
@@ -31,7 +19,7 @@
3119
"outputs": [],
3220
"source": [
3321
"import datetime as dt\n",
34-
"import pytz\n",
22+
"from zoneinfo import ZoneInfo, available_timezones\n",
3523
"\n",
3624
"NAIVE_DT = dt.datetime(2000, 1, 1, 10)"
3725
]
@@ -51,7 +39,7 @@
5139
},
5240
"outputs": [],
5341
"source": [
54-
"for tz in pytz.all_timezones:\n",
42+
"for tz in available_timezones():\n",
5543
" print(tz)"
5644
]
5745
},
@@ -96,7 +84,7 @@
9684
],
9785
"metadata": {
9886
"kernelspec": {
99-
"display_name": "Python 3",
87+
"display_name": "Python 3 (ipykernel)",
10088
"language": "python",
10189
"name": "python3"
10290
},
@@ -110,7 +98,7 @@
11098
"name": "python",
11199
"nbconvert_exporter": "python",
112100
"pygments_lexer": "ipython3",
113-
"version": "3.5.4"
101+
"version": "3.11.0"
114102
}
115103
},
116104
"nbformat": 4,

0 commit comments

Comments
 (0)
0