Newbie regular expression ?

Fredrik Lundh fredrik at pythonware.com
Tue Oct 4 14:44:10 EDT 2005


"len" <lsumnler at gmail.com> wrote:

>I have the following statement and it works fine;
>
>    list1 = glob.glob('*.dat')

that's a glob pattern, not a regular expression.

> however I now have an additional requirement the the string must begin
> with any form of "UNQ,Unq,unq,..."

    list1 = glob.glob('*.dat')
    list1 = [file for file in list1 if file.lower().startswith("unq")]

</F> 






More information about the Python-list mailing list