appending * to glob returns files with '*' !!

Sean DiZazzo half.italian at gmail.com
Sun Sep 21 19:11:02 EDT 2008


On Sep 19, 1:37 pm, "John [H2O]" <washa... at gmail.com> wrote:
> I have a glob.glob search:
>
> searchstring = os.path.join('path'+'EN*')

shouldn't that be  os.path.join(path, 'EN*')  ?

> ___
> This returns some files:
> EN082333
> EN092334
> EN*

Mine doesn't return that last string.

>
> My routine cannot handle the '*' and it should'nt be returned anyway? :-/
>
Well, its an easy fix.

files = glob.glob(searchstring)
for f in files:
      if not f[-1] =="*":
           print f

> A bug?

Post a small *tested* example that recreates the error on your system.

~Sean



More information about the Python-list mailing list