1. Digital numbers:
int long float Complex
51924361L 0.0 3.14j
100-0x19323l 15.20 45.J
-786 0122l-21.9 9.322e-36j
080 0xDEFABCECBDAECBFBAEl 32.3e+18.876j
-0490 535633629843l-90. -.6545+0j
-0x260-052318172735l-32.54e100 3e+26j
0x69-4721885298529l 70.2E-12 4.53e-7j
2. String: ' '
The string is: ordered, immutable
1 ' Ilovepython ' 2 Print (S[1:5]) # Out:love
3. List: []
The list is: ordered, variable
1List = ['Runoob', 786, 2.23,'John', 70.2 ]2Tinylist = [123,'John']3 4 PrintList#[' Runoob ', 786, 2.23, ' John ', 70.2]5 PrintLIST[0]#Runoob6 PrintList[1:3]#[786, 2.23]7 PrintList[2:]#[2.23, ' John ', 70.2]8 PrintTinylist * 2#[123, ' John ', 123, ' John ']9 PrintList + tinylist#[' Runoob ', 786, 2.23, ' John ', 70.2, 123, ' John ']
4. Tuple tuples: ()
Tuples are: Ordered, immutable
1 tuple = ( " runoob , 786, 2.23, " john ", 70.2 2 list = [ " runoob " , 786, 2.23, " john ", 70.2] 3 TUPLE[2] = # 4 list[2] = # list is a legitimate application /span>
5. Dictionary dict: {}
The dictionary is: unordered, key value immutable, value variable
1Dict = {}2dict[' One'] =" This is one"3DICT[2] =" This is the"4Tinydict = {'name':'John','Code': 6734,'Dept':'Sales'}5 6 Printdict[' One']# This is one7 PrintDICT[2]# This is the8 PrintTinydict#{' dept ': ' Sales ', ' Code ': 6734, ' name ': ' John '}9 PrintTinydict.keys ()#[' dept ', ' Code ', ' name ']Ten PrintTinydict.values ()#[' Sales ', 6734, ' John ']
01Python Base _02 Variable