Name =' Zcl,py,zyz '
names = [' Zcl ',' Py ',' Zyz ']
Print (names[0])
Print (names[0:2])#切片就是从里面取几个元素, from the first to the end of the first few. Gu Tou regardless of the tail when the value is taken.
Print (names[1])
#切片操作对字符串也适用
name1=[' Zcl ',' Py ',' Zyz ']
Print (name1[2])
num =ListRange10)) #用range生成列表 need to use list to force type conversion
Print (num)
NUM1 = list (range (1,21)" #用range生成列表, You need to use list to force the type conversion
print ( # # #), NUM1)
print (Num1[1: 10:2]) #print (num[from the first: take several: Take one from the other if you don't write it every other one])
print (num1[::-< span style= "color: #0000ff" >1]) #print (num[: Take a few: take a few, one by one if not written) ##### #反转了字符串, same as recover
#和列表一样, it's just immutable variables.
#定义元组时, if the tuple has only one element, add a comma after the element, or it will be a string
Lis = []#列表这样定义
TP = (' 127.0.0.1 ',' 3306 ')
#lis [0]= ' 3306 ' #不能这样写 because this list is empty, subscript 0 does not exist, use append or insert
print (LIS)
print (TP)
TP = ( ' 127.0.0.1 ', ' 3306 ') #元组
names = [1,2,3," Lingyul ", Panyang '] #列表
Name = ' lingyul,cyc '
New_lis = tuple (LIS)
print (type (new_lis))
#强制类型转换的int float str list tuple
Python automated test Aries-week3 slices + tuples