python核心笔记,防遗忘

熟练应用help()函数和dir()函数

 help()可以用来查看object对象模块函数方法的文档内容。

dir()可以用来查看对象的方法,属性

例子:

import math
import sys
print(help(math))
print(help(sys))
print(help(sys.exit))
print(dir(sys))
print(help("xyz".split)) # ==>str.split
print(help(list))
print(dir(list))
print(help(list.extend))

熟练应用上面的两个函数查看帮助和属性方法。当然前提是英语能看懂,看不懂就只能用翻译器翻译了。

 

posted @ 2022-04-04 15:02  枫木清风  阅读(34)  评论(0)    收藏  举报