[Tutor] Directory or File ?

Damien damien.gouteux at gmail.com
Tue Aug 2 18:00:07 CEST 2005


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 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 better way, please tell me.
>>
>>Thanks,
>>Damien G.
>>_______________________________________________
>>Tutor maillist  -  Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>
>>    
>>
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050802/b0b6ad7c/attachment.htm


More information about the Tutor mailing list