Search⌘ K
AI Features

Puzzle 6: Explanation

Explore how Python's import system works and why naming your files after standard library modules can cause errors. Understand sys.path, module lookup, and how to safely use relative imports to avoid naming conflicts in your projects.

We'll cover the following...

Let’s try it!

Try executing the code below to verify the results:

Python 3.8
from email.message import EmailMessage
msg = EmailMessage()
msg['From'] = 'xyz@someCompany.com'
msg['To'] = 'ABC <abc@privateCompany.com>'
msg.set_content('''\
Dear Sir.
I'm here to learn Python.
...
''')
print(msg)
...