You can access the Zen of Python with the following import:
Python
00:00
In this first lesson, I want to introduce you to The Zen of Python by Tim Peters. If you enter any more modern Python interpreter and then type import this and press Enter, then you get as a printout to your console a poem called The Zen of Python that was written by Tim Peters. The sentences in this poem encode a bit the idea of what does it mean to write Pythonic code.
00:25 You might see some of these sentences around as well. So, for example, “Simple is better than complex,” is quoted quite often, or “There should be only one obvious way to do something,” or “Readability counts.” You might encounter some of these sentences when a person argues for writing Pythonic code, and this is where they come from.
00:44 They all originate from The Zen of Python by Tim Peters. This poem is a bit of a guideline on how to write Pythonic code, but at the same time, it’s also a bit of a joke because the whole module was written in a way that is very un-Pythonic, so it just encodes a bit also this feeling of the Python community—that yes, you want to write very readable code, but also that you want to have fun while doing it.
01:07
This is also why this poem is quite loved by the Python community and often quoted. So now you know how to get to it. You just type import this, and then it prints out The Zen of Python.
01:18 I encourage you to try this in your interpreter and read over the poem, think about some of the sentences in there, and think about how they relate to the later lessons in this course, where you’re going to learn about some Pythonic ways of writing code. That’s all about The Zen of Python. In the next lesson, you’ll learn about how to set up your scripts and also how to handle statements in Python.