Learning Python by Mark Lutz

Learning Python by Mark Lutz

Author:Mark Lutz
Language: eng
Format: mobi, epub, pdf
Tags: COMPUTERS / Programming Languages / Python
Publisher: O'Reilly Media
Published: 2009-09-15T23:00:00+00:00


C:\test> C:\python30\python

>>> import pkg.spam

...text omitted...

ImportError: cannot import name string

Modules referenced by relative imports must exist in the package directory.

Imports are still relative to the CWD (again)

Although absolute imports let you skip package modules, they still rely on other components of sys.path. For one last test, let’s define two string modules of our own. In the following, there is one module by that name in the CWD, one in the package, and another in the standard library:

# test\string.py

print('string' * 8)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.