0
About extend in py
Is there any defence between extending a list to another and adding a list to a another? A = [1,2,3,4,5] B =[0,1,96,66,52] A.extend(B) print(A) And A = [1,2,3,4,5] B =[0,1,96,66,52] A = A+B print(A(
2 Respostas
+ 1
With extend(), B can be any kind of iterable, whereas with +, B can only be a list. This problem is solved using +=.
Other differences:
https://stackoverflow.com/questions/3653298/
+ 1
Ok... thanks alot Diego 👍