Need help capturing output of

joemacbusiness at joemacbusiness at
Fri Jun 27 00:31:57 CEST 2008

Hi -

I need help capturing the output of a RegEx search.
I dont understand why this conditional fails.

Here is the code:

#================================= start snip

import os
import re

dirName = '/home/user/bin/logs'
files = os.listdir(dirName)
for myFile in files:
#    print 'checking ...', myFile
    reCheck = ''
    reCheck ='\bCC_',  myFile)
#    print 'reCheck = ', '=', reCheck, '='

    if reCheck == "None":
        print myFile, '   ..... does not qualify'
        print '          ', myFile, 'qualifies...', reCheck

#================================= end snip

The problem is that reCheck never == None.
So all of the files "qualify".  My understanding of the ('\bCC_',  myFile)) is ...
1) give me  only files that start with a word boundary (\b)
2) followed by a (CC_)
3) in myFile

Why doesn't the output of the load reCheck with valid data?
(like "None")


More information about the Python-list mailing list