Michael Hoffman <[EMAIL PROTECTED]> wrote in comp.lang.python:
> Python Dunce wrote:
>
>> So if I happen
>> to be processing 'foo [bar].par2'
>>
>> glob.glob(filename[:-5]+'.*par2')
>>
>> doesn't return anything. Using
>> win32api.FindFiles(filename[:-5]+'.*par2') works perfectly, but I don't
Python Dunce wrote:
So if I happen
to be processing 'foo [bar].par2'
glob.glob(filename[:-5]+'.*par2')
doesn't return anything. Using win32api.FindFiles(filename[:-5]+'.*par2')
works perfectly, but I don't want to rely on win32api functions. I hope
that made more sense :).
If you look in the
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in comp.lang.python:
> code like below willprint all files ending on 'par2', except tose not
> containong 'vol' from the 5th position. is that what you need?
> -import glob
> -for nuke in glob.glob(r"""c:\temp\*.par2"""):
> -try:
> -nuke.in
code like below willprint all files ending on 'par2', except tose not
containong 'vol' from the 5th position. is that what you need?
-import glob
-for nuke in glob.glob(r"""c:\temp\*.par2"""):
-try:
-nuke.index('vol', 5)
-print nuke
-except ValueError, e:
-print e
-
I've run into an issue with glob and matching filenames with brackets '[]'
in them. The problem comes when I'm using part of such a filename as the
path I'm passing to glob. Here's a trimmed down dumb example. Let's say I
have a directory with the following files in it.
foo.par2
foo.vol0+1.p