detect if file or dir
bill-bell at bill-bell.hamilton.on.ca
Thu Jul 12 02:37:27 CEST 2001
pedro at athlet.de (pedro) wrote:
> how can i detect if sth. is a file or a directory? exists(directory)
> does tell me if sth. is a directory but exits my script wenn it hits a
I assume you mean that the use of 'exists' raises an exception?
Notwithstanding the comments offered by others on this list, I don't
think it should. For example, on my machine:
>>> os.path.exists ( r'c:\temp.txt')
ie, it works without raising an exception given a file name.
More information about the Python-list