Python3.x:python:extend (extension) differs from the Append (append) 1, the difference:
The append () method adds a new element to the tail of the list. Only one parameter is accepted;
The Extend () method takes only one list as an argument and adds each element of the parameter to the original list;
2, Example:
List_extend = ['a','b','C']list_extend.extend (['D','e','F']) Print("list_extend:%s"%list_extend)#output Result: list_extend:[' A ', ' B ', ' C ', ' d ', ' e ', ' F ']List_append = ['a','b','C']list_append.append (['D','e','F']) Print("list_append:%s"%list_append)#output Result: list_append:[' A ', ' B ', ' C ', [' d ', ' e ', ' F ']
Integrated Man
Links:http://www.cnblogs.com/lizm166/p/8232733.html
Source: Blog Park
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
The difference between python3.x:python:extend (extension) and append (append)