open(os.path.join(os.path.dirname(__file__), '../www/bin/picture.png'), 'rb')

MRAB google at mrabarnett.plus.com
Sat May 16 09:35:02 EDT 2009


Diez B. Roggisch wrote:
> gert schrieb:
>> open(os.path.join(os.path.dirname(__file__),'../www/bin/picture.png'),
>> 'rb')
>> how do you do this on windows (py3) so it still works on linux ?
> 
> os.path.join("..", "www", "bin", "picture.png")
> 
> Or use os.sep.
> 
Windows should understand '/' as well as '\'.



More information about the Python-list mailing list