Printing lists in columns
Hrvoje Niksic
hniksic at xemacs.org
Tue Sep 4 12:34:12 EDT 2007
cjt22 at bath.ac.uk writes:
>> for row in izip_longest(*d, fillvalue='*'):
>> print ', '.join(row)
>>
>> HTH
>
> I thought that but when I tried it I recieved a
> "Syntax Error: Invalid Syntax"
> with a ^ pointing to fillvalue :S
Python isn't too happy about adding individual keyword arguments after
an explicit argument tuple. Try this instead:
for row in izip_longest(*d, **dict(fillvalue='*')):
print ', '.join(row)
More information about the Python-list
mailing list