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

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

2010-12-30 Thread Javier Collado
Hello, 2010/12/30 smain...@free.fr: How can i do the same thing (wildcard in a directory name) in python please ? You can get the contents of a directory with os.listdir and filter with fnmatch.fnmatch more or less as in the example from the documentation: - import fnmatch

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

2010-12-30 Thread Cameron Simpson
On 30Dec2010 09:36, smain...@free.fr 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

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

2010-12-30 Thread Peter Otten
smain...@free.fr wrote: 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 :

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 c...@zip.com.au: On 30Dec2010 09:36, smain...@free.fr 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