Can't find any info on Python's read() method (python 2.7)

前端 未结 2 815
没有蜡笔的小新
没有蜡笔的小新 2021-01-25 16:45

I\'m trying to learn Python by going through Zed Shaw\'s \"Learn Python the hard way\" and I\'m stuck at what may seem as a very trivial thing. I\'m unable to find any info on t

2条回答
  •  独厮守ぢ
    2021-01-25 17:27

    read is a method on file objects. Use:

    python -m pydoc file
    

    to get the documentation for file objects. Note that this is exactly what the book told you to do, but it appears you left of the file argument.

    Alternatively, ask for just the method:

    python -m pydoc file.read
    

    The official documentation, however, is far richer and useful. See the documentation on File Objects for example.

提交回复
热议问题