1. 赋值:
#整型
integer_number = 90
#浮点
float_number = 90.4
#复数
complex_number = 10 + 10j
#list 序列
sample_list = [1,2,3,'abc']
#dictionary 字典
sample_dic = {"key":value, 2:3}
#tuple 只读的序列
sample_tuple = (1,3,"ab")
Python 程序流程控制
条件判断结构
flag1 = some_value
flag2 = other_value
if flag1:
do_function_1()
elif flag2:
do_function_2()
else:
do_function_3()
循环结构
for i in range(0, 10):
print(i)
for i in ['a','b','c','dd','eee'];
print(i)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/86824/viewspace-671499/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/86824/viewspace-671499/