首页 > 技术文章 > python中如何使用help命令?

zichun-zeng 2014-11-26 11:47 原文

python下 help()使用方法

 

查看python所有的modules:help("modules")

单看python所有的modules中包含指定字符串的modules: help("modules yourstr")

查看python中常见的topics: help("topics")

查看python标准库中的module:import os.path + help("os.path")

查看python内置的类型:help("list")

查看python类型的成员方法:help("str.find")

查看python内置函数:help("open")  / help(open)

查看python其他模块中的子模块:help(maplotlib.pyplot)    #前提是先要把该模块import进来,

如果是查看该子模块里的函数,还要再 from package import module

比如要查看matplotlib中pyplot里的scatter函数,则需要 :

import matplotlib
from matplotlib import pyplot as plt
help(plt.scatter)

 

 

参考博文:http://www.cnblogs.com/laifu/p/3633034.html

推荐阅读