python列表的方法
aStr="火锅底料,白菜,土豆" alist=["火锅底料","白菜","土豆","萝卜","臭豆腐","粑粑"] print(aStr[2]) print(alist[2:4]) print(alist[4:]) #索引区范围,包前不报后 print("--------") alist1=["火锅底料","白菜","土豆","萝卜","臭豆腐","粑粑"] alist2=[1,2,3,4,5] alist=[alist1,alist2] print(alist) #列表可以嵌套 print("----append----") alist=["火锅底料","白菜","土豆","萝卜","臭豆腐","粑粑"] alist.append('肥牛') print(alist) print("----pop----") alist=["火锅底料","白菜","土豆","萝卜","臭豆腐","粑粑"] print(alist) alist.pop() print(alist) print("----del----") alist=["火锅底料","白菜","土豆","萝卜","臭豆腐","粑粑"] print(alist) del alist[-1] print(alist) print("----运算----") alist1=["火锅底料","白菜","土豆","萝卜","臭豆腐",