Python高级特性

切片(Slice) 切片:截取list、tuple或者str的元素 L = [0, 1, 2, 3, 4, 5] print(L[: 3]) # [0, 1, 2]...

Python函数

定义函数 定义函数:返回两个数中的较大者 def my_max(a, b): if a > b: return a return b 如果没有return语句,函数执行完毕后也会返回结果,只是结果为None。ret...

循环和流程控制

if语句 非零数值、非空字符串、非空list等,会判断为True,否则为False age = 3 if age >= 18: print('adult') elif age >= 6: print('teenager') else: print('kid') match语句...

Python集合

list(列表) 创建 s = ['python', 'java', ['asp', 'php'], 'scheme'] print(type(s)) # <class 'list'> list是一种可变的有序的集合,可以随时添加和删除其中的元素,使用[] 创建, classmates = ['Mi...

Python基础语法

数据类型 汇总 print(type(100)) # <class 'int'> print(type(1.23)) # <class 'float'> print(type(True)) # <class 'bool'> print(type('A')) # <class 'str'> print...

消息盒子

# 暂无消息 #

只显示最新10条未读和已读信息