Purpose: Proficiency in the use of list functions, convenient management of multiple variable values
Environment: Ubuntu 16.04 python 3.5.2
Scenario: The list should be used in data processing often to use a type, can be ordered, combined with the operation of the value of storage, is a useful function ... This is the last piece of notes to be collated, to find that typography is a waste of time, that there is no communication, or that it is quicker to write notes in a similar way to OneNote.
List:
List (), which is an iterative object, commonly used for, join, sort, reverse, sorted, index, and slice.
Some of its own operations include:
box = list () or box = [] Set empty lists
Box.append (' value ') trailing append element
Box.insert (1, ' value ') Index insert Element
Box[0] = ' value ' index replace or write element
Box.pop () Delete trailing elements
Box.pop (1) Index Delete element
Box.index (' value ') gets the element subscript
Del Box[1] Delete the specified element
Sorted (box) returns a new forward list
Mate Method:
Sort () in-place forward sort
Reverse () reverse sort in place
Delimiter. Join (box) to specify a symbolic connection list element as a string
Slice reference string (private chain)
Extended:
The list can be generated in a list with a quick and concise style.
New_list = [x for x in range] if not x% 2]
This article is from the "Rickyhul" blog, make sure to keep this source http://rickyh.blog.51cto.com/10934856/1955648
Use of lists in Python