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

Diez B. Roggisch deets at nospam.web.de
Sat May 16 09:16:42 EDT 2009


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.

Diez



More information about the Python-list mailing list