Sunday, August 28, 2011

Extend vs Append

Could be useful.


>>> x = [1,2,3]
>>> y = [4,5,6]
>>> x.append(y)
>>> x
[1, 2, 3, [4, 5, 6]]
>>> x.remove(y)
>>> x
[1, 2, 3]
>>> x.extend(y)
>>> x
[1, 2, 3, 4, 5, 6]
>>>

No comments:

Post a Comment