在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python/ Python中的_socket模塊在什么地方?

Python中的_socket模塊在什么地方?

在標(biāo)準(zhǔn)庫的socket.py文件開頭, 有這樣的描述:

# Wrapper module for _socket, providing some additional facilities
# implemented in Python.

我在標(biāo)準(zhǔn)庫中并沒有發(fā)現(xiàn)這里所說的_socket相關(guān)信息, 它是一個(gè)什么東西?

回答
編輯回答
放開她

查看兩個(gè)模塊的文檔.
_socket是在鏈接庫里的.也就是說這不是用python實(shí)現(xiàn)的,是socket操作的C實(shí)現(xiàn),這個(gè)是非常底層的操作.socket.py是用py代碼把C實(shí)現(xiàn)的模塊的封裝起來之后的模塊,供人使用.
在不同系統(tǒng)_socket的位置不一樣,你可以具體去看,然后想看源碼的話就要去直接看未編譯的python源碼,才能看到_socket的代碼.

In [3]: _socket?
Type:        module
String form: <module '_socket' from '/usr/lib64/python2.7/lib-dynload/_socketmodule.so'>
File:        /usr/lib64/python2.7/lib-dynload/_socketmodule.so
Docstring:
Implementation module for socket operations.

See the socket module for documentation.
In [5]: socket?
Type:        module
String form: <module 'socket' from '/usr/lib64/python2.7/socket.pyc'>
File:        /usr/lib64/python2.7/socket.py
Docstring:
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.
2017年3月26日 11:50