首页 > 编程语言 >Python3_2022

Python3_2022

时间:2022-08-16 16:33:25浏览次数:81  
标签:Sequence else 序列 num 2022 集合 class Python3

1、Python中 __init__的通俗解释是什么? 

 

2、Python数据结构之序列(Sequence)、集合(Set)、映射(Mapping)

不可变序列(Immutable Sequence):字符串(class str)、元组(class tuple)、字节串(class bytes)、范围(class range)。

可变序列(Mutable Sequence):列表(class list)、字节数组(class bytearray)。  

集合是一种可迭代的、无序的、不可以包含重复元素的数据结构。

集合:可变集合(set)和不可变集合(frozenset)。

 

映射(Mapping):只有字典(dict)。

3、if else在同一行

【python】 if - else写在一行

num = 1 if param > 10 else 0

等价于

if param > 10 :
    num = 1
else:
    num = 0

4、python 集合的操作

 

 

 

 

标签:Sequence,else,序列,num,2022,集合,class,Python3
From: https://www.cnblogs.com/liyonghua/p/16499670.html

相关文章