How can I import a py script by its absolute path name?

John Machin sjmachin at lexicon.net
Thu Jul 14 15:04:57 CEST 2005


Thorsten Kampe wrote:
> * Edvard Majakari (2005-07-14 12:52 +0100)
> 
>>could ildg <could.net at gmail.com> writes:
>>
>>>I want to import c:\xxx\yyy\zzz.py into my programme,
>>>What should I do?
>>>Thank you~
>>
>>import sys
>>sys.path.append('c:\xxx\yyy')
> 
> 
> "sys.path.append('c:\\xxx\\yyy')" or "sys.path.append('c:/xxx/yyy')"

or  "sys.path.append(r'c:\xxx\yyy')"



More information about the Python-list mailing list