Re: open file in dir independently of operating system

2005-05-25 Thread Kay Schluehr
Joerg Schuster schrieb: > Hello, > > > I want to open the file 'configuration.smo' that is in directory dir. > Yet, I don't know on which os my program is being run. On Unix I would > say: > > f = open(dir + '/configuration.smo', 'r') > > What is the os-independent version of this line? Did You c

Re: open file in dir independently of operating system

2005-05-25 Thread Thomas Heller
Gerald Klix schrieb: > Hi, > it`s > > import os > f = open( os.path.join( dir , 'configuration.smo' ), 'r' ) *nix-heads everywhere? For a text file, I would prefer: f = open( os.path.join( dir , 'configuration.smo' ), 'U' ) and for a binary file: f = open( os.path.join( dir , 'configuration

Re: open file in dir independently of operating system

2005-05-25 Thread Joerg Schuster
Thanks, Andrew and Gerald. Jörg -- http://mail.python.org/mailman/listinfo/python-list

Re: open file in dir independently of operating system

2005-05-25 Thread Gerald Klix
Hi, it`s import os f = open( os.path.join( dir , 'configuration.smo' ), 'r' ) HTH, Gerald Joerg Schuster schrieb: > Hello, > > > I want to open the file 'configuration.smo' that is in directory dir. > Yet, I don't know on which os my program is being run. On Unix I would > say: > > f = open(d

Re: open file in dir independently of operating system

2005-05-25 Thread Andrew Bushnell
I believe you want: import os f = open(os.path.join(dir, 'configuration.smo'), 'r') ... Joerg Schuster wrote: > Hello, > > > I want to open the file 'configuration.smo' that is in directory dir. > Yet, I don't know on which os my program is being run. On Unix I would > say: > > f = open(dir

open file in dir independently of operating system

2005-05-25 Thread Joerg Schuster
Hello, I want to open the file 'configuration.smo' that is in directory dir. Yet, I don't know on which os my program is being run. On Unix I would say: f = open(dir + '/configuration.smo', 'r') What is the os-independent version of this line? (I have read the manual of the module os, but I di