2009/5/31 Nick Burgess <burgess.n...@gmail.com>: > Got it. > > the row is not a string or buffer but the cell is.. > > for row in spamReader: > for cell in row: > if pattern.search(cell): > print ', '.join(row) > > Alternatively, if you know that the string you want to search for only appears in a single cell from the row, you could use
for row in spamReader: if pattern.search(cell[coll_number_here]): print ', '.join(row) If there is a range of adjacent cells that could contain the text, you could try something like if pattern.search('|'.join(row[3:5]) For non-adjacent cells, try something like targetCells = [1,3,5] for row in spamReader: if pattern.search('|'.join(row[i] for i in targetCells)) Both of these solutions will be faster than iterating over th entire row, unless tht is specifically what you want. -- Richard "Roadie Rich" Lovely, part of the JNP|UK Famile www.theJNP.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor