python on Linux

Chris Angelico rosuav at
Fri Oct 10 08:58:07 CEST 2014

On Fri, Oct 10, 2014 at 5:31 PM, Irmen de Jong <irmen.NOSPAM at> wrote:
> On 10-10-2014 6:21, Igor Korot wrote:
>> Hi, ALL,
>> When I am on Windows, I can write something like this:
>> sys.path.append('C:\Users\Igor\Documents\MyLib')
> While this might work on your system, it may not work on others.
> - you need to escape the backslashes (or just use forward slashes, they work on windows too)
> - not all windows installations and versions have their user folders in
> C:\Users\<username>. On windows too, you'll have to use something like %USERPROFILE% to
> get to the correct directory if you want it to work correctly in all cases.

AIUI you can use os.path.expanduser() on Windows as well, and it'll
take care of USERPROFILE.


More information about the Python-list mailing list