复习加补充

alt+enter 引用模块,自动安装导入 第三方模块
ctrl+shift+F 在项目中查找关键字
ctrl+shift+N 在项目中查找文件名
ctrl+r 替换 (第一行是原来的内容,第2️⃣行是替换的内容,包括正则大小写都可以)
2018-3-31 python 字典基本使用方法
字符串(str)的查找find,替换replace,分割split,拼接join,首位去空格strip,startwith, enfwith
find和index,find找不到返回-1,
字符串格式化format()
list.index下标,verse反转,count统计,insert插入,pop删除,sort排序,clear清空,append追加,remove删除,
(元组)
{字典}
[列表]

学习内容

  • 字典

推荐网站www.json.cn

key:value
2018-3-31 python 字典基本使用方法

  • dict.get
    找到返回对应value,找不到返回none,或定义字符串
    2018-3-31 python 字典基本使用方法
  • dict.pop

pop删除,有返回值,删除什么返回什么
2018-3-31 python 字典基本使用方法

  • dict.clear

清空字典
2018-3-31 python 字典基本使用方法

  • dict.copy

看对比图
2018-3-31 python 字典基本使用方法
2018-3-31 python 字典基本使用方法

  • keys和values

返回的是列表
2018-3-31 python 字典基本使用方法

update相当于+
2018-3-31 python 字典基本使用方法
2018-3-31 python 字典基本使用方法

type显示类型
print(type(x))

强制类型转换
list()
int()
str()
float()
tuple()
dict()

print(isinstance(x.list)) #判断x是不是list格式
print(hasattr(x.”append”)) #判断x有没有append属性

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-23
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-12
  • 2021-08-27
  • 2022-12-23
  • 2021-11-17
  • 2021-06-20
  • 2021-10-31
  • 2021-11-21
相关资源
相似解决方案