Python 批量抓取help()函数的帮助内容(附36M帮助文档)

简介: Python 批量抓取help()函数的帮助内容(附36M帮助文档)

在python提示符下,help(int)可以得到 class int 的帮助; help("math") 可以得到 built-in module math 的帮助;...等等

>>> help(int)
Help on class int in module builtins:
class int(object)
 |  int([x]) -> integer
 |  int(x, base=10) -> integer
 |  
 |  Convert a number or string to an integer, or return 0 if no arguments
 |  are given.  If x is a number, return x.__int__().  For floating point
 |  numbers, this truncates towards zero.
 |  
 |  If x is not a number or if base is given, then x must be a string,
 |  bytes, or bytearray instance representing an integer literal in the
 |  given base.  The literal can be preceded by '+' or '-' and be surrounded
 |  by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.
 |  Base 0 means to interpret the base from the string as an integer literal.
 |  >>> int('0b100', base=0)
 |  4
 |  
 |  Built-in subclasses:
 |      bool
 |  
 |  Methods defined here:
 |  
 |  __abs__(self, /)
 |      abs(self)
 |  
 |  __add__(self, value, /)
 |      Return self+value.
 |  
 |  __and__(self, value, /)
 |      Return self&value.
 |  
 |  __bool__(self, /)
 |      self != 0
 |  
 |  __ceil__(...)
 |      Ceiling of an Integral returns itself.
 |  
 |  __divmod__(self, value, /)
 |      Return divmod(self, value).
 |  
 |  __eq__(self, value, /)
 |      Return self==value.
 |  
 |  __float__(self, /)
 |      float(self)
 |  
 |  __floor__(...)
 |      Flooring an Integral returns itself.
 |  
 |  __floordiv__(self, value, /)
 |      Return self//value.
 |  
 |  __format__(self, format_spec, /)
 |      Default object formatter.
 |  
 |  __ge__(self, value, /)
 |      Return self>=value.
 |  
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |  
 |  __getnewargs__(self, /)
 |  
 |  __gt__(self, value, /)
 |      Return self>value.
 |  
 |  __hash__(self, /)
 |      Return hash(self).
 |  
 |  __index__(self, /)
 |      Return self converted to an integer, if self is suitable for use as an index into a list.
 |  
 |  __int__(self, /)
 |      int(self)
 |  
 |  __invert__(self, /)
 |      ~self
 |  
 |  __le__(self, value, /)
 |      Return self<=value.
 |  
 |  __lshift__(self, value, /)
 |      Return self<<value.
 |  
 |  __lt__(self, value, /)
 |      Return self<value.
 |  
 |  __mod__(self, value, /)
 |      Return self%value.
 |  
 |  __mul__(self, value, /)
 |      Return self*value.
 |  
 |  __ne__(self, value, /)
 |      Return self!=value.
 |  
 |  __neg__(self, /)
 |      -self
 |  
 |  __or__(self, value, /)
 |      Return self|value.
 |  
 |  __pos__(self, /)
 |      +self
 |  
 |  __pow__(self, value, mod=None, /)
 |      Return pow(self, value, mod).
 |  
 |  __radd__(self, value, /)
 |      Return value+self.
 |  
 |  __rand__(self, value, /)
 |      Return value&self.
 |  
 |  __rdivmod__(self, value, /)
 |      Return divmod(value, self).
 |  
 |  __repr__(self, /)
 |      Return repr(self).
 |  
 |  __rfloordiv__(self, value, /)
 |      Return value//self.
 |  
 |  __rlshift__(self, value, /)
 |      Return value<<self.
 |  
 |  __rmod__(self, value, /)
 |      Return value%self.
 |  
 |  __rmul__(self, value, /)
 |      Return value*self.
 |  
 |  __ror__(self, value, /)
 |      Return value|self.
 |  
 |  __round__(...)
 |      Rounding an Integral returns itself.
 |      Rounding with an ndigits argument also returns an integer.
 |  
 |  __rpow__(self, value, mod=None, /)
 |      Return pow(value, self, mod).
 |  
 |  __rrshift__(self, value, /)
 |      Return value>>self.
 |  
 |  __rshift__(self, value, /)
 |      Return self>>value.
 |  
 |  __rsub__(self, value, /)
 |      Return value-self.
 |  
 |  __rtruediv__(self, value, /)
 |      Return value/self.
 |  
 |  __rxor__(self, value, /)
 |      Return value^self.
 |  
 |  __sizeof__(self, /)
 |      Returns size in memory, in bytes.
 |  
 |  __sub__(self, value, /)
 |      Return self-value.
 |  
 |  __truediv__(self, value, /)
 |      Return self/value.
 |  
 |  __trunc__(...)
 |      Truncating an Integral returns itself.
 |  
 |  __xor__(self, value, /)
 |      Return self^value.
 |  
 |  as_integer_ratio(self, /)
 |      Return integer ratio.
 |      
 |      Return a pair of integers, whose ratio is exactly equal to the original int
 |      and with a positive denominator.
 |      
 |      >>> (10).as_integer_ratio()
 |      (10, 1)
 |      >>> (-10).as_integer_ratio()
 |      (-10, 1)
 |      >>> (0).as_integer_ratio()
 |      (0, 1)
 |  
 |  bit_length(self, /)
 |      Number of bits necessary to represent self in binary.
 |      
 |      >>> bin(37)
 |      '0b100101'
 |      >>> (37).bit_length()
 |      6
 |  
 |  conjugate(...)
 |      Returns self, the complex conjugate of any int.
 |  
 |  to_bytes(self, /, length, byteorder, *, signed=False)
 |      Return an array of bytes representing an integer.
 |      
 |      length
 |        Length of bytes object to use.  An OverflowError is raised if the
 |        integer is not representable with the given number of bytes.
 |      byteorder
 |        The byte order used to represent the integer.  If byteorder is 'big',
 |        the most significant byte is at the beginning of the byte array.  If
 |        byteorder is 'little', the most significant byte is at the end of the
 |        byte array.  To request the native byte order of the host system, use
 |        `sys.byteorder' as the byte order value.
 |      signed
 |        Determines whether two's complement is used to represent the integer.
 |        If signed is False and a negative integer is given, an OverflowError
 |        is raised.
 |  
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |  
 |  from_bytes(bytes, byteorder, *, signed=False) from builtins.type
 |      Return the integer represented by the given array of bytes.
 |      
 |      bytes
 |        Holds the array of bytes to convert.  The argument must either
 |        support the buffer protocol or be an iterable object producing bytes.
 |        Bytes and bytearray are examples of built-in objects that support the
 |        buffer protocol.
 |      byteorder
 |        The byte order used to represent the integer.  If byteorder is 'big',
 |        the most significant byte is at the beginning of the byte array.  If
 |        byteorder is 'little', the most significant byte is at the end of the
 |        byte array.  To request the native byte order of the host system, use
 |        `sys.byteorder' as the byte order value.
 |      signed
 |        Indicates whether two's complement is used to represent the integer.
 |  
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |  
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  denominator
 |      the denominator of a rational number in lowest terms
 |  
 |  imag
 |      the imaginary part of a complex number
 |  
 |  numerator
 |      the numerator of a rational number in lowest terms
 |  
 |  real
 |      the real part of a complex number

可以用以下代码,批量抓取帮助文档,部分文档的内容很有学习参考价值。

import sys
str=["int","float","complex","str","array","list","tuple","set","dict",
     "math","cmath","random","sys","os","json","pickle","shelve","xml",
     "re","logging","getpass","subprocess","hashlib","shutil","time",
     "datetime","configparser","traceback","itertools",
     "openpyxl","pyautogui","pymysql","numpy","pandas","scipy","six",
     "matplotlib","pybrain","ipython","seaborn","anaconda","yaml",
     "esptool","jupyter","sympy","markupsafe","pymsgbox","mouseifo",
     "win32api","win32con","win32gui","help"]
i = 0
out = sys.stdout #保存标准输出流
for s in str:
    i += 1
    fn = "help" + ("%03d" % i) + "_" + s + ".txt"
    f=open(fn, 'w')
    sys.stdout = f
    help(s)
    f.close()
sys.stdout = out #恢复标准输出流
print("end")


帮助文档清单:

   E:\Python>dir help*

    驱动器 E 中的卷没有标签。

    卷的序列号是 000D-8746

    E:\Python 的目录

   2021/03/24 周三  23:23              7,376 help001_int.txt

   2021/03/24 周三  23:23              5,393 help002_float.txt

   2021/03/24 周三  23:23              3,055 help003_complex.txt

   2021/03/24 周三  23:23            15,060 help004_str.txt

   2021/03/24 周三  23:23            18,132 help005_array.txt

   2021/03/24 周三  23:23              3,730 help006_list.txt

   2021/03/24 周三  23:23              2,026 help007_tuple.txt

   2021/03/24 周三  23:23              4,323 help008_set.txt

   2021/03/24 周三  23:23              3,891 help009_dict.txt

   2021/03/24 周三  23:23              8,109 help010_math.txt

   2021/03/24 周三  23:23              2,949 help011_cmath.txt

   2021/03/24 周三  23:23            25,506 help012_random.txt

   2021/03/24 周三  23:23            15,424 help013_sys.txt

   2021/03/24 周三  23:23            51,197 help014_os.txt

   2021/03/24 周三  23:23            24,838 help015_json.txt

   2021/03/24 周三  23:23            21,188 help016_pickle.txt

   2021/03/24 周三  23:23            18,570 help017_shelve.txt

   2021/03/24 周三  23:23              1,225 help018_xml.txt

   2021/03/24 周三  23:23            18,428 help019_re.txt

   2021/03/24 周三  23:23            51,018 help020_logging.txt

   2021/03/24 周三  23:23              3,728 help021_getpass.txt

   2021/03/24 周三  23:23            22,244 help022_subprocess.txt

   2021/03/24 周三  23:23            14,001 help023_hashlib.txt

   2021/03/24 周三  23:23            23,320 help024_shutil.txt

   2021/03/24 周三  23:23            11,092 help025_time.txt

   2021/03/24 周三  23:23            21,670 help026_datetime.txt

   2021/03/24 周三  23:23            79,356 help027_configparser.txt

   2021/03/24 周三  23:23            18,562 help028_traceback.txt

   2021/03/24 周三  23:23            20,645 help029_itertools.txt

   2021/03/24 周三  23:23                 942 help030_openpyxl.txt

   2021/03/24 周三  23:23            50,019 help031_pyautogui.txt

   2021/03/24 周三  23:23            83,204 help032_pymysql.txt

   2021/03/24 周三  23:23       2,573,280 help033_numpy.txt

   2021/03/24 周三  23:23              3,354 help034_pandas.txt

   2021/03/24 周三  23:23       1,866,667 help035_scipy.txt

   2021/03/24 周三  23:23            21,210 help036_six.txt

   2021/03/24 周三  23:23            24,818 help037_matplotlib.txt

   2021/03/24 周三  23:23                   73 help038_pybrain.txt

   2021/03/24 周三  23:23                 139 help039_ipython.txt

   2021/03/24 周三  23:23                 733 help040_seaborn.txt

   2021/03/24 周三  23:23                 140 help041_anaconda.txt

   2021/03/24 周三  23:23            13,057 help042_yaml.txt

   2021/03/24 周三  23:23          187,145 help043_esptool.txt

   2021/03/24 周三  23:23                 200 help044_jupyter.txt

   2021/03/24 周三  23:23     30,978,676 help045_sympy.txt

   2021/03/24 周三  23:23            20,481 help046_markupsafe.txt

   2021/03/24 周三  23:23              1,705 help047_pymsgbox.txt

   2021/03/24 周三  23:23                 140 help048_mouseifo.txt

   2021/03/24 周三  23:23            10,124 help049_win32api.txt

   2021/03/24 周三  23:23          129,227 help050_win32con.txt

   2021/03/24 周三  23:23            13,720 help051_win32gui.txt

   2021/03/24 周三  23:23          126,032 help052_help.txt

   2021/03/24 周三  23:24          833,031 help_Python.rar

                 53 个文件     37,454,173 字节

                  0 个目录 162,196,828,160 可用字节

   E:\Python>



目录
相关文章
|
15天前
|
数据采集 JSON 数据处理
抓取和分析JSON数据:使用Python构建数据处理管道
在大数据时代,电商网站如亚马逊、京东等成为数据采集的重要来源。本文介绍如何使用Python结合代理IP、多线程等技术,高效、隐秘地抓取并处理电商网站的JSON数据。通过爬虫代理服务,模拟真实用户行为,提升抓取效率和稳定性。示例代码展示了如何抓取亚马逊商品信息并进行解析。
抓取和分析JSON数据:使用Python构建数据处理管道
|
19天前
|
Python
Python之函数详解
【10月更文挑战第12天】
Python之函数详解
|
20天前
|
存储 数据安全/隐私保护 索引
|
9天前
|
测试技术 数据安全/隐私保护 Python
探索Python中的装饰器:简化和增强你的函数
【10月更文挑战第24天】在Python编程的海洋中,装饰器是那把可以令你的代码更简洁、更强大的魔法棒。它们不仅能够扩展函数的功能,还能保持代码的整洁性。本文将带你深入了解装饰器的概念、实现方式以及如何通过它们来提升你的代码质量。让我们一起揭开装饰器的神秘面纱,学习如何用它们来打造更加优雅和高效的代码。
|
12天前
|
数据采集 Python
python爬虫抓取91处理网
本人是个爬虫小萌新,看了网上教程学着做爬虫爬取91处理网www.91chuli.com,如果有什么问题请大佬们反馈,谢谢。
23 4
|
11天前
|
弹性计算 安全 数据处理
Python高手秘籍:列表推导式与Lambda函数的高效应用
列表推导式和Lambda函数是Python中强大的工具。列表推导式允许在一行代码中生成新列表,而Lambda函数则是用于简单操作的匿名函数。通过示例展示了如何使用这些工具进行数据处理和功能实现,包括生成偶数平方、展平二维列表、按长度排序单词等。这些工具在Python编程中具有高度的灵活性和实用性。
|
14天前
|
Python
python的时间操作time-函数介绍
【10月更文挑战第19天】 python模块time的函数使用介绍和使用。
19 4
|
13天前
|
数据采集 Java Python
如何用Python同时抓取多个网页:深入ThreadPoolExecutor
在信息化时代,实时数据的获取对体育赛事爱好者、数据分析师和投注行业至关重要。本文介绍了如何使用Python的`ThreadPoolExecutor`结合代理IP和请求头设置,高效稳定地抓取五大足球联赛的实时比赛信息。通过多线程并发处理,解决了抓取效率低、请求限制等问题,提供了详细的代码示例和解析方法。
如何用Python同时抓取多个网页:深入ThreadPoolExecutor
|
15天前
|
存储 Python
[oeasy]python038_ range函数_大小写字母的起止范围_start_stop
本文介绍了Python中`range`函数的使用方法及其在生成大小写字母序号范围时的应用。通过示例展示了如何利用`range`和`for`循环输出指定范围内的数字,重点讲解了小写和大写字母对应的ASCII码值范围,并解释了`range`函数的参数(start, stop)以及为何不包括stop值的原因。最后,文章留下了关于为何`range`不包含stop值的问题,留待下一次讨论。
13 1
|
21天前
|
索引 Python
Python中的其他内置函数有哪些
【10月更文挑战第12天】Python中的其他内置函数有哪些
13 1