参考《集体智慧编程》
page:1-10
数组:
number_list = [1,2,3]
string_list = [‘a’,’b’,’c’]
mixed_list = [‘a’,3,’c’,8]
字典:
ages={‘John’:24,’Sarah’:28,’Mike’:31}
可以用通过序列名后跟方括号的形式来访问字典中的元素:
string_list[2] #returns ‘c’
ages[‘Sara’] #returns 28
Python利用缩进来定义代码块
if x==1
print ‘x is 1’
print ‘Still in if block’
print ‘outside if block’