python: list manipulation -


i have list l of objects (for it's worth in scons). create 2 lists l1 , l2 l1 l item i1 appended, , l2 l item i2 appended.

i use append modifies original list.

how can in python? (sorry beginner question, don't use language much, scons)

l1 = l + [i1] l2 = l + [i2] 

that simplest way. option copy list , append:

l1 = l[:]       #make copy of l l1.append(i1) 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -