Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # append_vs_extend.py
- x = [1, 2, 3]
- x.append([4, 5])
- print (x)
- # gives you: [1, 2, 3, [4, 5]]
- x = [1, 2, 3]
- x.extend([4, 5])
- print (x)
- # gives you: [1, 2, 3, 4, 5]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement