shawn bright wrote:
> hello there,
> i am writing an app for linux. what command would be easiest to test and
> see if a certain file exist ?
os.path.exists() or os.path.isfile()
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
Hi,
import os
if os.path.exists('/path/to/file'):
# File exists
else:
# File doesn't exist
It works for files as well as directories.
Regards,
Vikram U Shenoy
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tut
On Thu, 4 Jan 2007, Andre Roberge wrote:
>> > i am writing an app for linux. what command would be easiest to test
>> > and see if a certain file exist ?
>> > i was going to do something like this
>> > try:
>> > file = open('/path/to/file', 'rb')
>> > return True
>> > except:
>> > re
thanks, luke, Andre.
appreciate it a lot
shawn
On 1/3/07, Andre Roberge <[EMAIL PROTECTED]> wrote:
On 1/4/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
>
> shawn bright wrote:
> > hello there,
> > i am writing an app for linux. what command would be easiest to test
> > and see if a certai
On 1/4/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
shawn bright wrote:
> hello there,
> i am writing an app for linux. what command would be easiest to test
> and see if a certain file exist ?
> i was going to do something like this
> try:
> file = open('/path/to/file', 'rb')
> retu
shawn bright wrote:
> hello there,
> i am writing an app for linux. what command would be easiest to test
> and see if a certain file exist ?
> i was going to do something like this
> try:
> file = open('/path/to/file', 'rb')
> return True
> except:
> return False
You should except IOE
hello there,
i am writing an app for linux. what command would be easiest to test and see
if a certain file exist ?
i was going to do something like this
try:
file = open('/path/to/file', 'rb')
return True
except:
return False
but i thought that there would be an easier way.
thanks
_