Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Marcelo Garcia edited this page Feb 28, 2023 · 2 revisions

Welcome to the Introduction_Python wiki!

The Search Path

Python search for modules in a list defined in the sys.path:

>>> import sys
>>> sys.path
['', 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\\python310.zip', 
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\\DLLs', (...)]
>>>

You can even modify the list by adding your modules

>>> sys.path.insert(0, os.path.join(os.path.expanduser('~'), 'Work', 'examples'))
>>> sys.path
['C:\\Users\\Marcelo Garcia\\Work\\examples', '', 
Clone this wiki locally