Re: os.path.isfile and wildcard for directory name

2010-12-30 Thread smainklh
Hi Cameron,

Ok, i'll try that :)

Thanks
Smaine

Selon Cameron Simpson :

> On 30Dec2010 09:36, smain...@free.fr  wrote:
> | I want to test if a file exists but my path contain a directory name that
> | differs from a server to another.
> | In shell i would have done something like that :
> | #!/bin/bash
> | mypath=/dire*/directory02/
> | myfile=filename
> | myfile=toto
> | if [ -f $mypath/$myfile ]
> [...]
>
> Check out the glob module:
>   http://docs.python.org/library/glob.html#module-glob
>
> Use it to do the glob, then os.path.isfile with a path constructed from
> the result:
>
>   http://docs.python.org/library/os.path.html#os.path.isfile
>
> Cheers,
> --
> Cameron Simpson  DoD#743
> http://www.cskk.ezoshosting.com/cs/
>
> Any company large enough to have a research lab
> is large enough not to listen to it. - Alan Kay
>


-- 
http://mail.python.org/mailman/listinfo/python-list


os.path.isfile and wildcard for directory name

2010-12-30 Thread smainklh


Hi everyone,

I'm just beginning to learn python language and i'm trying to do something and i
can't figure it out.

I want to test if a file exists but my path contain a directory name that
differs from a server to another.
In shell i would have done something like that :

#!/bin/bash

mypath=/dire*/directory02/
myfile=filename

myfile=toto

if [ -f $mypath/$myfile ]
   then
   echo "File $file exists"
fi


How can i do the same thing (wildcard in a directory name) in python please ?

Thanks for your help !

Smaine
-- 
http://mail.python.org/mailman/listinfo/python-list