1. Basic Data type
2. List
There are no arrays in Python!!! And the arrays are similar to lists and tuples.
A list is a container for storing a chain of elements. To be represented by [], arranged in an orderly manner.
3, meta-group
The elements inside the tuple are also available for index calculation.
The difference between a tuple and a list:
The value of the element in the ① list can be modified, but the value of the element inside the tuple is not modifiable.
The symbol for the ② list is [], and the tuple's symbol is ()
4. Collection
The collection in Python has two functions, one is to build relationships, and the other is to eliminate duplicate elements (principle: The elements in the collection are unique, and the elements in the string are not unique, and the result is heavy after the string set)
The format of the collection is: Set (Element)
#Encoding:utf-8A=set ("Abcnmaaaaggsng") b=set ("CDFM")#intersectionx=a&b#and sety=a|b#Difference Setz=a-b#Remove duplicate elementsnew=set (a)Print "The intersection is: {0}\n is set to: {1}\n difference set is: {2}\na after removing duplicate elements: {3}". Format (x,y,z,new)
The output result is
The intersection is: Set (['C','m']) and set as: Set (['a','C','b','D','g','F','m','N','s']) Difference set is: set (['a','s','b','g','N'] A after removing the repeating element: set (['a','C','b','g','m','s','N'])
5. Dictionaries
The dictionary in Python is an associative array, enclosed in curly braces {}.
# encoding:utf-8score={" Chinese ": "A ", " mathematics ": English ": 2}score[" computer graphics "]=69 for" Score: print"{0} has a score of: {1}". Format (Key,score[key])
The output is:
The results of the mathematics are: the results of the Chinese language: The results of the English: 2 Computer graphics:69
Python-07:python Syntax Basics-Data types