Python Path Dictionary

Gary Herron gherron at
Tue Aug 21 17:42:08 CEST 2007

aine_canby at wrote:
> Hi,
> Do the Python Paths come in the form of a dictionary where I can
> access a particular path my its key in the registry?
> For example, in PythonWin Tools>>Edit Python Paths shows the name as
> well of the address of each path
> Thanks,
> Aine
If by "Python Paths" you mean the list of directories searched when
doing an import, then it is a list (not a dictionary and you can access
it as sys.path.

Here it is on both my Linux and Windows systems:

>>> import sys
>>> sys.path
['', '/usr/lib/portage/pym', '/usr/lib/',
'/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload',

>>> import sys
>>> sys.path
['', 'C:\\WINDOWS\\system32\\', 'C:\\cygwin\\home\\Gary',
'c:\\python24\\DLLs', 'c:\\python24\\lib',
'c:\\python24\\lib\\plat-win', 'c:\\python24\\lib\\lib-tk',
'c:\\python24', 'c:\\python24\\lib\\site-packages',

More information about the Python-list mailing list