[Tutor] how to check whether a file exists or not??

Ziad Rahhal ziad.rahhal at gmail.com
Thu Oct 12 17:00:53 CEST 2006


On 10/12/06, Asrarahmed Kadri <ajkadri at googlemail.com> wrote:
>
>
> Hello,
>
> Sorry, but this is a very basic questions...
> Can you tell me how to check the existence of a file..
>

    to check if a file exists, you can use os.path.exists(path)
    or look at http://python.org/doc/current/lib/module-os.path.html for
more info


Also if a file exists, and we open it in a write mode, it would be truncated
> to zero length. So what is the way out of this??#
>
> Regards,
>
> Asrar
> --
> To HIM you shall return.
>
> _______________________________________________
> 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/20061012/8412d7de/attachment.htm 


More information about the Tutor mailing list