参考书籍《heafirst python》
这本可以当查询手册dive into python>。在线地址在此
书中使用的python版本为3.x。但因为很多devops,比如各种stack还是使用2.x。所以我下载了python2.7.8来学习。
下载地址:http://mirrors.sohu.com/python/2.7.8/
下载包为:python-2.7.8.amd64.msi
进入idle(gui)后即可以使用。
首先当一个计算器
>>> 3+4
7
>>> 2/3
0
>>> 2%3
2
>>>
将两个list给互相插嵌起来
要用这个
#!/usr/bin/python
cast=['cheese', 'Plain', 'Jones']
cast2=[11,22,33]
cast3=[]
i=0
l=len(cast)
for each_var1 in cast:
if i<l:
print(i)
cast3.append(cast[i])
cast3.append(cast2[i])
i=i+1
print(cast3)
#end