【问题标题】:where does the random.random.__doc__ doc string live?random.random.__doc__ 文档字符串在哪里?
【发布时间】:2016-09-18 23:14:39
【问题描述】:

print random.random.__doc__ 调用的文本在哪里存在?

FWIW,我已阅读文档页面:https://docs.python.org/2/library/random.html

并理解区间符号和help()

但通过 C:\Python27\Lib\random.py 阅读

我没有找到文档字符串:random() -> x in the interval [0, 1).

打印此文本的文件在哪里?

BorrajaX's answer 让我觉得它可能在 os.py 中,但我什至在 os.py 中都找不到 urandom 并且在阅读此内容后:

https://docs.python.org/2/library/os.html#os.urandom

我认为 os.py 不是查看的地方。

【问题讨论】:

  • @jonrsharpe - 我对 cpython 一无所知。该文件是否位于 C:\Python27 中的某个位置?
  • 我认为那个文件夹的结构应该和repo一样,所以检查C:\Python27\Modules
  • win7... 没有 C:\Python27\Modules :\ 我可以访问 Linux 操作系统并将在那里检查。这个链接有一些有用的信息:stackoverflow.com/questions/18857355/…
  • @jonrsharpe,好吧,我在 Ubuntu 系统上查看 usr/lib/python2.7 无济于事。找到 2.7.py 脚本,但没有 cpython 和模块...?

标签: python-2.7


【解决方案1】:

每@jonrsharpe:模块/_randommodule.c https://hg.python.org/cpython/file/tip/Modules/_randommodule.c#l418

这也很有帮助: https://docs.python.org/2/faq/library.html#where-is-the-math-py-socket-py-regex-py-etc-source-file

在我的 win7 笔记本电脑上,将其放入 powershell:

PS C:\Users\patrick> Get-ChildItem -Path C:\ -Filter *.c -Recurse

导致只有 *.c 文件与 ffmpeg 关联...

根据文档 url 在 python shell 中打这个:

>>> import sys
>>> print sys.builtin_module_names

我明白了:

('__builtin__', '__main__', ... '_random',...)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-05
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2010-09-27
    • 1970-01-01
    • 2010-09-30
    • 2020-07-02
    相关资源
    最近更新 更多