What is the difference between Python's list methods append and extend
https://stackoverflow.com/questions/252703/what-is-the-difference-between-pythons-list-methods-append-and-extend
WEBOct 31, 2008 · 20 Answers. Sorted by: 5867. .append() appends a specified object at the end of the list: >>> x = [1, 2, 3] >>> x.append([4, 5]) >>> print(x) [1, 2, 3, [4, 5]] .extend() extends the list by appending elements from the specified iterable: >>> x = [1, 2, 3] >>> x.extend([4, 5]) >>> print(x) [1, 2, 3, 4, 5] edited Apr 16 at 0:04. smci.
DA: 99 PA: 86 MOZ Rank: 14