====== Python 语法基础 ====== ===== Python 变量类型 ===== Python是有变量类型的,而且会强制检查变量类型。\\ 内置的变量类型有如下几种: #整型 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") #嵌套 sample_nest = [(1,2,3),{1:2,3:4,'key':[1,2]},3] ===== 一切都是对象 ===== 'str str'.split() # ['str', 'str'] # 1..is_integer() # True # is_integer(1) # True # 1.0.is_integer() # False [3,2,1].sort() # [1,2,3] sort([2,1,3]) # [1,2,3] ===== 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) ===== Python 标准库 ===== Python 带有很丰富的标准库,给开发带来了很大的方便。 \\