Gilles Ganault <[EMAIL PROTECTED]> writes:
> for match in matches:
>       if mytable[item]=="":
>               mytable[item]= match.group(1)
>       else:
>               mytable[item]= mytable[item] + "," + match.group(1) #
> ----------- END
> =======================
> 
> Can the lines between BEGIN/END be simplified so I can copy all the
> items into the mytable[] dictionary in one go, instead of getting each
> one in a row, and append them with a comma, eg.

Yes, look at the string.join method and generator expressions.  You'd
say:

  mytable[item] = ','.join(m.group(1) for m in matches)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to