dictionary:
n.items()n.keys()n.values()
三种都是无序的
generate a list according to some logic
evens_to_50 = [i for i in range(51) if i % 2 == 0]even_squares = [x ** 2 for x in range(1,12) if x % 2 == 0]
list负数:reserve the list
letters = ['A', 'B', 'C', 'D', 'E']print letters[::-1]#['E', 'D', 'C', 'B', 'A']
lambda用法
my_list = range(16)print filter(lambda x: x % 3 == 0, my_list)
slice
str = "ABCDEFGHIJ"start, end, stride = 1, 6, 2str[start:end:stride]