repeat items in a list

Random832 random832 at fastmail.com
Mon Mar 28 10:04:42 EDT 2016


On Mon, Mar 28, 2016, at 07:36, larudwer wrote:
> in case you want to mainain order:
> 
>  >>>> ["a","b"]*3
> ['a', 'b', 'a', 'b', 'a', 'b']
> 
> is completely suffincient.

I think you've completely missed the point of what order he's talking
about. How do you turn ['a', 'c', 'b'] into ['a', 'a', 'a', 'c', 'c',
'c', 'b', 'b', 'b']?



More information about the Python-list mailing list