[Tutor] looking for a pattern in a lot of files

Jonas Melian jonasmg at softhome.net
Sun May 22 22:07:11 CEST 2005


I've to looking for a pattern ('locale for') in a lot of files
(/dir/*_[A-Z][A-Z])

it's goes ok

any improvement about this code?
how print the actual file?
could i add an exception? by if there aren't files


for line in fileinput.input(glob.glob(os.path.join
        (dir_locales, "*_[A-Z][A-Z]"))):
    if re.search("locale for", line):
        print line


More information about the Tutor mailing list