[Tutor] Using Python and Regex

Alan Gauld alan.gauld at btinternet.com
Mon Aug 11 18:23:06 CEST 2014


On 11/08/14 08:56, Bill wrote:

Just a wee point I noticed:

> def traverse_dirs(wdir):
>      grabline = 0
>      for f in os.listdir('.'):
>          if os.path.isfile(f) == True:
>              if "Email Exceeded Maximum Size Limit" in f:
>                  continue

Note that this checks whether the string is in the file *name*.
It does not test if the string is in the file content.
Is that really what you want?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list