Thanks for your good comments. I do think I found a work around body = "" for x in range(0,len(line_array)): test_line = len(re.findall(r'[0-9]{2}/[0-9]{2}/[0-9]{4}', line_array[x])) if test_line > 0: body = body + line_array[x]+"\n"
For each iteration re.findall returns a list object based upon the regex search. If an element contains "01/04/2013".....the regex is found, and re.findall returns it as a list object ['01/04/2013'] I can then perform a len function on that which will = 1, since the list contains only one string object. For the row in which the regex is not found, re.findall will return [] Which is essentially a list with 0 objects, and the len function will then = 0. Thanks Alan G for your example!! It will be fun to try it!! :-] I look for the KISS model in coding, and I like your example. -- bw...@fastmail.net _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor