python in parentheses knowledge

Python language is divided into several types of brackets, parentheses are three common parentheses (), the intermediate parentheses [] and braces. Its function is different, Python representing different basic built-in data types.

python brackets

python parentheses (): Indicates the type of data tuple-tuple, tuple sequence is immutable. Bathroom cabinet Monopoly create it very simple. Most of the time, it is enclosed in parentheses.

"> TUP = l, 2,3)
" TUP "
(l, 2,3)
>
> () empty tuple
()
>
>> 55,65507;
(55)
Python tuple traversal sorting method of operation of the operation more tuple Detailed explanation.

Python [] brackets represent the list list of data types, variable sequence listing. Its unique creative method is simple, as follows:

> List ( 'Python')
[ 'P', 'the Y', 'T', 'H', 'O', 'N']
To tuples in the same way to create an empty list or a list of values, only using different brackets. pyhton list operation is more suitable for beginners to understand what list yes.

python brackets braces: dict dictionary data showing the type of dictionary values ​​of the group consisting of a bond. Colon ":" and the partition key value, comma "," spacer group. Create braces as follows:

dic=jon':'boy'、'lili':'girl'
> DIC
_lili':'girl'、'jon':'boy'
>

The specific operation method of the dictionary can be seen python dict dictionary mapping type defined operation.

Guess you like

Origin www.cnblogs.com/blogst/p/11349985.html