2.1 # lst=['asdgg','as','drtysr'] # lst2=[i.upper() for i in lst if len(i) >3 ] # print(lst2) # 2.2 # tu=[(x,y) for x in range(6) if x%2==0 for y in range(6) if y%2==0] # print(tu) # # 2.3 # M=[[1,2,3],[4,5,6],[7,8,9]] # a=[i[2] for i in M] # print(a) # # 2.4 # a=[i**2 for i in range(50 ) if i %3==0] # print(a) # # 2.5 # a=['python%s期' % i for i in range(1,11)] # print(a) # # 2.6 # a=[(i,i+1) for i in range(6)] # print(a) # # 2.7 # a=[i for i in range(0,20,2)] # print(a) # # 2.8 # l1=['alex','wusir','老男孩','太白'] # a=[(l1[i]+str(i)) for i in range(4)] # print(a) # # 2.9 # x={ # 'name':'alex', # 'values':[{'timestamp':1517991992.94,'values':100}, # {'timestamp':1517992000.94,'values':300}, # {'timestamp':1517992014.94,'values':300}, # {'timestamp': 1517992744.94, 'values': 350}, # {'timestamp': 1517992800.94, 'values': 280}, # # ]} # a=[[i['timestamp'],i['values']] for i in x['values']] # print(a)