Possible duplicate:Merge two lists in python?
How can I add list items to another list?
A = ['1', '2'] B = ['3', '4'] A.append(B) print A
returns
['1', '2', ['3', '4']]
How can I do it
['1', '2', '3', '4']?
A.extend(B)
or
A += B
This text is added so that I can post this answer.
list.extend , for example, in your case A.extend(B) .
list.extend
it can also be done as
for s in B: A.append(B)
Of course, A.extend(B) does the same job, but using append , we need to add to the above f
append
Source: https://habr.com/ru/post/915544/More articles:IPython laptop on Heroku - pythonHow to combine two LPCWSTRs in C ++ - c ++RubyMotion and pointers - ruby ββ| fooobar.comCreating a foreign key for system tables - sql-serverUploading files remotely to Selenium WebDriver using PHP - phpCan I pass multiple flag values ββwith the same name? - javascriptMutation observers --- subtree - webkitLWJGL, Clojure, Single Thread for OpenGL Commands - multithreadingNode.js server code protection - node.jsInsert certain limited numbers into a SQL Server column - sqlAll Articles