1.unpacking 使用类似tuple的形式多项赋值,而不是逐项: list1 = [ ‘ hello ‘ , ‘ world ‘ , ‘ python ‘ , ‘ java ‘ ] # h = list1[0] # w = list1[1] h,w = list1[:2]
1.unpacking
使用类似tuple的形式多项赋值,而不是逐项:
list1 = [‘hello‘,‘world‘,‘python‘,‘java‘] # h = list1[0] # w = list1[1] h,w = list1[:2]