Printing with interspersed element
invalid at invalid
Thu Oct 30 21:21:46 CET 2008
On 2008-10-30, Paulo J. Matos <pocm at ecs.soton.ac.uk> wrote:
> Hi all,
> I guess this is a recurring issue for someone who doesn't really know
> the python lib inside out. There must be a simple way to do this.
> I have a list of objects [x1, x2, x3, ..., xn] and I have defined a
> print method for them print_obj(). Now I want to print them
> intersepersed by an element.
> If I print [x1, x2, x3] interspersed by the element 10:
> x1.print_obj() 10 x2.print_obj() 10 x3.print_obj()
>>> ','.join([str(i) for i in [1,2,3,4]])
>>> ','.join([i.__repr__() for i in [1,2,3,4]])
>>> ','.join([str(i) for i in ])
Grant Edwards grante Yow! What I want to find
at out is -- do parrots know
visi.com much about Astro-Turf?
More information about the Python-list