regular expression concatenation with strings

Jacek Trzmiel sc0rp at hot.pl
Fri Jun 22 23:30:31 CEST 2007


Hi,

oscartheduck wrote:
> I noticed a small error in the code (you referenced extension, which
> you had renamed to filenameRx), and when I corrected it I received the
> original error again.

I haven't had PIL installed, so I just commented out im.* calls for 
test. Just change:
   im.save(file + ".thumbnail." + extension)
to:
   im.save(file + ".thumbnail" + ext)


> What was it you were trying to do to solve the
> problem, though?

You can't use glob with regexps.  Instead use os.listdir() to get 
filenames and then rx.match() to find ones that does match the pattern.

Best regards,
Jacek.




More information about the Python-list mailing list