# -*- coding:utf-8 -*- __author__ = 'gjw' __time__ = '2018/1/11 0011 ä¸å 1:59' # é¢ç®ï¼å表使ç¨å®ä¾ã # list # æ°å»ºå表 testList = [10086, 'ä¸å½ç§»å¨', [1, 2, 4, 5]] # 访é®å表é¿åº¦ print(len(testList)) # å°å表ç»å°¾ print(testList[1:]) # åå表添å å ç´ testList.append('i\'m new here!') print(len(testList)) print(testList[-1]) # å¼¹åºå表çæåä¸ä¸ªå ç´ print(testList.pop(1)) print(len(testList)) print(testList) # list comprehension # å颿ä»ç»ï¼ææ¶æ è¿ matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(matrix) print(matrix[1]) col2 = [row[1] for row in matrix] # get a column from a matrix print(col2) col2even = [row[1] for row in matrix if row[1] % 2 == 0] # filter odd item print(col2even)