I have a list, a
:
a = [\'a\',\'b\',\'c\']
and need to duplicate some values with the suffix _ind
added this way (
Before list comprehensions and generators were invented/became widespread, people used to think much simpler1:
>>> a = ['a', 'b', 'c']
>>> b = []
>>> for x in a: b.extend([x, x+'_ind'])
...
>>> b
['a', 'a_ind', 'b', 'b_ind', 'c', 'c_ind']
* I don't mean that those constructs/tools are evil, just wanted to point out that there is a simple solution.