Difference between ʻappend and ʻextend
used when you want to attach lists in python
append
a = [1,2]
a.append(3)
>>> [1,2,3]
a = [1,2]
a.append([1,2])
>>> [1,2,[1,2]]
extend
a = [1,2]
a.extend(3)
>>> [1,2,3]
a = [1,2]
a.extend([1,2])
>>> [1,2,1,2]
Recommended Posts