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