I'm making a list in the following way:
lst = ['val1', 'val2', 'val3']
output = [item for it in lst]
...however, I would like to add an arbitrary number of each item to the list, not just one.
Something like this (if I wanted to add 3 elements each time to the list):
output = [item*3 for item in lst]
...so that if lst
looks like this:
['val1', 'val2', 'val3']
...output
looks like this:
['val1', 'val1', 'val1', 'val2', 'val2', 'val2'...]
How can I accomplish this?