python004比较运算符


运算符 Python 表达式 结果 描述 支持的数据类型
+ [1, 2] + [3, 4] [1, 2, 3, 4] 合并 字符串、列表、元组
* ‘Hi!’ * 4 [‘Hi!’, ‘Hi!’, ‘Hi!’, ‘Hi!’] 复制 字符串、列表、元组
in 3 in (1, 2, 3) True 元素是否存在 字符串、列表、元组、字典
not in 4 not in (1, 2, 3) True 元素是否不存在 字符串 大专栏  python004比较运算符、列表、元组、字典

python内置函数

序号 方法 描述
1 cmp(item1, item2) 比较两个值
2 len(item) 计算容器中元素个数
3 max(item) 返回容器中元素最大值
4 min(item) 返回容器中元素最小值
5 del(item) 删除变量

猜你喜欢

转载自www.cnblogs.com/wangziqiang123/p/11691269.html