Python: extend items in a list
I am trying to create a new list based on the old one, from ['a', 'b', 'c'] to ['a12', 'b12', 'c12'].
the classic way could be:
a = ['a','b','c']
aa = []
for item in a:
aa.append(item + '12')
print aa
however I want to know the best way so that I try:
aa = a.extend('12%s' % item for item in l[:])
and
aa = [item.join('12') for item in l]
but they do not give the most correct one. What are the best ways?
thank.
+3
source to share