abhinayaraj.r...@emulex.com writes: > if '####' in data: > count = 4 > elif '###' in data: > count = 3 > elif '##' in data: > count = 2 > elif '#' in data: > count = 1 > elif data.find('#') == -1: > count = 0
import re max_sharps = reduce(max, map(len, re.findall('#+', data)), 0) max_sharps = min(max_sharps, 4) -- http://mail.python.org/mailman/listinfo/python-list