当前位置:首页>python>99个常用Python语法知识点,快学起来!

99个常用Python语法知识点,快学起来!

  • 2026-10-21 13:29:55
99个常用Python语法知识点,快学起来!

99个常用Python语法知识点,快学起来!

资料已经打包好了,需要的公众号发送“11”领取
➢基础语法:
1.注释: #单行注释
"多行注释"
2.变量:直接赋值,如x=5
3.数据类型:int, float, str, bool
4.类型转换:int(),float(), str(), bool()
5.运算符: ,一,*,/, //,%,
6.比较运算符:==,!=,>, <, >=,<=
7.逻辑运算符:and, or, not
8.位运算符:&,|,^,~,<<,>>
➢文件操作:
9.打开文件:open('filename' , 'mode')
10.读文件:file.read()
11.写文件:file.write('text')
12.逐行读文件:for line in file
13.关闭文件:file.close()
14.with语句:with open('filename",'mode')as file
➢常用标准库:
15.os:操作系统接口
16.sys:Python解释器接口
17.math:数学函数
18. datetime:日期和时间处理
19.re:正则表达式
20.json: JSON解析与生成!
21.cSv: CSV文件读写
22.random:随机数生成
23. time:时间访问和转换
24.collections:高效数据结构
25.itertools:迭代器函数
26. functools:高阶函数和操作
27.operator:函数形式的标准操作符
➢数据结构:
28.列表:[],如my_ _list=[1, 2,3]
29.元组:(),如my_ _tuple=(1, 2,3)
30.字典:{},如my_ dict ={'key':'value'}
31.集合:set(),如my_ set={1, 2, 3}
32.列表解析:[x for x in iterable]
33.字典解析:{k:v for k,v in iterable}
#Python #编程 #代码 #计算机专业 #计算机 #干货分享 #Python编程 #学习 #Python学习

名称已清空
微信扫一扫赞赏作者
喜欢作者其它金额
文章
暂无文章
喜欢作者
其它金额
最低赞赏 ¥0
其它金额
赞赏金额
¥
最低赞赏 ¥0
1
2
3
4
5
6
7
8
9
0
.
湖南,2026年1月9日 17:21,

最新文章

随机文章