如何在python中查看socket模块中connect函数的doc

时间:2013-11-23 10:05:20

标签: python sockets

我想查看socket.connect函数doc,我尝试了三种方法。只有最后一个可以看到。如果我想查看modle.functionName doc,该怎么做?

  python  python3
Python 3.3.2 (default, Sep  8 2013, 14:22:38)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> help(socket.connect)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'connect'
>>> help(connect)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'connect' is not defined
>>> help(socket)

1 个答案:

答案 0 :(得分:1)

您需要的是套接字模块中的套接字类,路径为socket.socket.connect

import socket
help(socket.socket.connect)