Created
June 14, 2017 03:20
-
-
Save gjlondon/9b3e83e9ff5b7157175a2041b00a9e63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# most of the time, don't use dots at all: | |
from spam import eggs | |
# If Python has trouble finding spam and spam.py is in the same directory: | |
# (i.e. "package" as the code doing the import): | |
from .spam import eggs | |
# when spam.py is in the *enclosing* package, i.e. one level up: | |
from ..spam import eggs | |
# ImportError! At least in Python 3, you can only use the dots with | |
# the `from a import b` syntax: | |
import .spam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment