Python核心模块你知道哪些?库的使用和解析

Python核心模块你知道哪些?库的使用和解析

编码文章call10242025-05-11 14:51:346A+A-

核心模块

o 1.1. 介绍

o 1.2. _ _builtin_ _ 模块

o 1.3. exceptions 模块

o 1.4. os 模块

o 1.5. os.path 模块

o 1.6. stat 模块

o 1.7. string 模块

o 1.8. re 模块

o 1.9. math 模块

o 1.10. cmath 模块

o 1.11. operator 模块

o 1.12. copy 模块

o 1.13. sys 模块 o 1.14. atexit 模块

o 1.15. time 模块

o 1.16. types 模块

o 1.17. gc 模块

2. 更多标准模块

o 2.1. 概览

o 2.2. fileinput 模块

o 2.3. shutil 模块

o 2.4. tempfile 模块

o 2.5. StringIO 模块

o 2.6. cStringIO 模块

o 2.7. mmap 模块

o 2.8. UserDict 模块

o 2.9. UserList 模块

o 2.10. UserString 模块

o 2.11. traceback 模块

o 2.12. errno 模块

o 2.13. getopt 模块

o 2.14. getpass 模块

o 2.15. glob 模块

o 2.16. fnmatch 模块

o 2.17. random 模块

o 2.18. whrandom 模块

o 2.19. md5 模块

o 2.20. sha 模块

o 2.21. crypt 模块

o 2.22. rotor 模块

o 2.23. zlib 模块

o 2.24. code 模块

3. 线程和进程

o 3.1. 概览

o 3.2. threading 模块

o 3.3. Queue 模块

o 3.4. thread 模块

o 3.5. commands 模块

o 3.6. pipes 模块

o 3.7. popen2 模块

o 3.8. signal 模块

4. 数据表示

o 4.1. 概览

o 4.2. array 模块

o 4.3. struct 模块

o 4.4. xdrlib 模块

o 4.5. marshal 模块

o 4.6. pickle 模块

o 4.7. cPickle 模块

o 4.8. copy_reg 模块

o 4.9. pprint 模块

o 4.10. repr 模块

o 4.11. base64 模块

o 4.12. binhex 模块

o 4.13. quopri 模块

o 4.14. uu 模块

o 4.15. binascii 模块

5. 文件格式

o 5.1. 概览

o 5.2. xmllib 模块

o 5.3. xml.parsers.expat 模块

o 5.4. sgmllib 模块

o 5.5. htmllib 模块

o 5.6. htmlentitydefs 模块

o 5.7. formatter 模块

o 5.8. ConfigParser 模块

o 5.9. netrc 模块

o 5.10. shlex 模块

o 5.11. zipfile 模块

o 5.12. gzip 模块

6. 邮件和新闻消息处理

o 6.1. 概览

o 6.2. rfc822 模块

o 6.3. mimetools 模块

o 6.4. MimeWriter 模块

o 6.5. mailbox 模块

o 6.6. mailcap 模块

o 6.7. mimetypes 模块

o 6.8. packmail 模块

o 6.9. mimify 模块

o 6.10. multifile 模块


python模块太多了!先介绍一下这一些部分!当然掌勺已经把全部python模块和解析以及怎么使用做成了pdf文件,需要这个文件的,可以关注一下掌勺,然后私信,就会给你了!在给大家介绍一下一些模块怎么使用!

1.2. _ _builtin_ _ 模块

这个模块包含 Python 使用的内建函数. 一般不用手动导入这个模块; Python会帮你做好一切.

1.2.1. 使用元组或字典中的参数调用函数

Python允许你实时地创建函数参数列表. 只要把所有的参数放入一个元组中,然后通过内建的 apply 函数调用函数. 如 Example 1-1 .

1.2.1.1. Example 1-1. 使用 apply 函数

File: builtin-apply-example-1.py

def function(a, b):

print a, b

apply(function, ("whither", "canada?"))

apply(function, (1, 2 + 3))

1.2.1.2. Example 1-2. 使用 apply 函数传递关键字参数

File: builtin-apply-example-2.py

def function(a, b):

print a, b

apply(function, ("crunchy", "frog"))

apply(function, ("crunchy",), {"b": "frog"})

apply(function, (), {"a": "crunchy", "b": "frog"})

1.2.2.5. Example 1-8. 使用 reload 函数

File: builtin-reload-example-1.py

import hello

reload(hello)

reload(hello)

点击这里复制本文地址 以上内容由文彬编程网整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
qrcode

文彬编程网 © All Rights Reserved.  蜀ICP备2024111239号-4