Python有线程。import threading;  class EventLoopThread(Thread): def run(self): ...

import asyncore
class EchoHandler(asyncore.dispatcher_with_send):
    def handle_read(self):
        data = self.recv(8192)
        if data: self.send(data)
class EchoServer(asyncore.dispatcher):
    def __init__(self, host, port):
        asyncore.dispatcher.__init__(self)
        self.create_socket()
        self.set_reuse_addr()
        self.bind((host, port))
        self.listen(5)
    def handle_accepted(self, sock, addr):
        print('Incoming connection from %s' % repr(addr))
        handler = EchoHandler(sock)
server = EchoServer('localhost', 8080)
asyncore.loop()
View Code

Deprecated since version 3.6: Please use asyncio instead. Note This module exists for backwards compatibility only. For new code we recommend using asyncio. C++是不是觉得iostream比fprintf, fwrite好?反正我照用不误。

array - Efficient arrays of numeric values. Arrays are sequence types and behave very much like lists, except that the type of objects stored in them is constrained.

array('l')
array('u', 'hello \u2641')
array('l', [1, 2, 3, 4, 5])
array('d', [1.0, 2.0, 3.14])
View Code

The audioop module provides support for a-LAW, u-LAW and Intel/DVI ADPCM encodings.

The atexit module defines functions to register and unregister cleanup functions.

posted on 2021-12-08 16:54  华容道专家  阅读(49)  评论(0)    收藏  举报