Composite data type

### Data Type: List list, tuples tuple, dictionary dict, set inside the sequence set 1. python sequence TYPE two categories: • immutable sequence (tuple, str) • variable sequence (list) 2. collection set object is a collection of unordered collection of mutually different hashable objects. set variable, frozenset immutable. 3. dictionary dict str operator, functions, list, and tuple are provided. 4. List list (list) is a storage purpose or operation of a collection of data. The method defined function list 4.1 4.2 4.3 list index list and a list of two-dimensional shear index still pictures method 4.4 4.5 4.6 conventional method list in the list to change the value of 4.7 and repeats a list splice sequences are added [1,2,3] + [4,5,6] # [1,2,3,4,5,6] 'Hello,' + 'world!' # 'Hello, world!' [1,2,3] + 'world!' 2 sequence multiplying a = [ 'a', 'b', 'c'] a * 3 # [ 'a', 'b', 'c', 'a', 'b', 'c', 'a' , 'b', 'c'] 4.8 membership users = [ 'Evan', 'John', 'Sherry'] input ( 'Enter your user name:') in users # Enter your user name: Evan # True 4.9 copy a = [1,2,3] b = ab [1] = 4 a # [1,4,3] #### a = [1,2,3] b = a.copy () b [1] = 4 a # [1,2,3] #### a = [1,2,

Guess you like

Origin www.cnblogs.com/lvzw/p/11391180.html