我正在尝试使用powershell找出seek在Python中的作用

问题描述 投票:0回答:1

当我使用此命令搜索它时 python -m pydoc 文件。寻找

python -m pydoc file. seek

把这个带回给我

No Python documentation found for 'file.seek'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

我学习Python已经有一段时间了 从书中学习Python的艰难之路 有一个练习告诉我使用 pydoc 搜索 file.seek

我正在尝试寻找答案来帮助我解决问题,我希望在这里找到答案

python powershell seek
1个回答
0
投票

要使

python -m pydoc file.seek
成功,必须在搜索路径中找到该文件。 正如消息所说,
Use help() to get the interactive help utility.

>>> help()

Welcome to Python 3.12's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the internet at https://docs.python.org/3.12/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help> file
No Python documentation found for 'file'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

help>

在这种情况下无法找到该文件。这就是问题所在。 让我们在一个可以找到并且包含函数的文件上尝试该命令 存在。

help> os.lseek
Help on built-in function lseek in os:

os.lseek = lseek(fd, position, whence, /)
    Set the position of a file descriptor.  Return the new position.

      fd
        An open file descriptor, as returned by os.open().
      position
        Position, interpreted relative to 'whence'.
      whence
        The relative position to seek from. Valid values are:
        - SEEK_SET: seek from the start of the file.
        - SEEK_CUR: seek from the current file position.
        - SEEK_END: seek from the end of the file.

    The return value is the number of bytes relative to the beginning of the file.

help> q

所以,对于

python -m pydoc os.lseek
我们正在寻找的模块和功能 帮助必须存在。

C:\Users\ctynd>python -m pydoc os.lseek
Help on built-in function lseek in os:

os.lseek = lseek(fd, position, whence, /)
    Set the position of a file descriptor.  Return the new position.

      fd
        An open file descriptor, as returned by os.open().
      position
        Position, interpreted relative to 'whence'.
      whence
        The relative position to seek from. Valid values are:
        - SEEK_SET: seek from the start of the file.
        - SEEK_CUR: seek from the current file position.
        - SEEK_END: seek from the end of the file.

    The return value is the number of bytes relative to the beginning of the file.


C:\Users\ctynd>
© www.soinside.com 2019 - 2024. All rights reserved.