Re: [Tutor] Directory or File ?

2005-08-02 Thread Damien
Ok, sorry. In the future, I will look more closely the module before sending my question. Thanks. Kent Johnson a écrit : Damien wrote: Hi all, I want to know if a file is a directory or a simple file. Look at os.path.isdir() Kent I have done a little ugly sc

Re: [Tutor] Directory or File ?

2005-08-02 Thread Wolfram Kraus
Damien wrote: > Hi all, > I want to know if a file is a directory or a simple file. > I have done a little ugly script : > # i is my filename, os is imported > old = os.getcwd() > try: > chdir(i) > is_dir = True > except: > is_dir = False > os.chdir(old) > return is_dir > > But maybe t

Re: [Tutor] Directory or File ?

2005-08-02 Thread Kent Johnson
Damien wrote: > Hi all, > I want to know if a file is a directory or a simple file. Look at os.path.isdir() Kent > I have done a little ugly script : > # i is my filename, os is imported > old = os.getcwd() > try: > chdir(i) > is_dir = True > except: > is_dir = False > os.chdir(old)

[Tutor] Directory or File ?

2005-08-02 Thread Damien
Hi all, I want to know if a file is a directory or a simple file. I have done a little ugly script : # i is my filename, os is imported old = os.getcwd() try: chdir(i) is_dir = True except: is_dir = False os.chdir(old) return is_dir But maybe there is a better way ? If you know a bette