this worked before...' '.join([`x x` for x in range(1, 6)])

John McMonagle jmcmonagle at velseis.com.au
Mon May 19 18:44:05 EDT 2008


notnorwegian at yahoo.se wrote:
> ' '.join([`x  x` for x in range(1, 6)])
> 
> anyone can tell me what im doing wrong?
> --
> http://mail.python.org/mailman/listinfo/python-list
> 


' '.join(['%s %s' % (str(x), str(x)) for x in range(1,6)])

or

' '.join([str(x)+' '+str(x) for x in range(1,6)])


outputs....

'1 1 2 2 3 3 4 4 5 5'


Is that what you were after ?



More information about the Python-list mailing list