<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Ok, sorry. In the future, I will look more closely the module before
sending my question.<br>
Thanks.<br>
<br>
Kent Johnson a écrit :
<blockquote cite="mid42EF8156.4080704@tds.net" type="cite">
<pre wrap="">Damien wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi all,
I want to know if a file is a directory or a simple file.
</pre>
</blockquote>
<pre wrap=""><!---->
Look at os.path.isdir()
Kent
</pre>
<blockquote type="cite">
<pre wrap="">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 - <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
</pre>
</blockquote>
<pre wrap=""><!---->
_______________________________________________
Tutor maillist - <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
</pre>
</blockquote>
<br>
</body>
</html>