第二章 网络编程 1.学习笔记 2.课后习题 答案是按照自己理解和查阅资料来的,不保证正确性.如由错误欢迎指出,谢谢 1. 套接字:A network socket is an endpoint of a connection across a computer network,Sockets are often represented internally as simple integers, which identify which connection to use. 套接字是网络通信的
使用SocketServer 模块来完成服务端编程 1.服务端代码如下: #!/usr/bin/python #!coding:utf-8 import SocketServer as socketserver class ClientHandler(socketserver.BaseRequestHandler): def handle(self): print '[info] server has recive a connection :{0}'.format(self.client_ad
15-1. 识别下列字符串:“bat,” “bit,” “but,” “hat,” “hit,” 或 “hut” from re import match word = raw_input('input: ') m = match('^[bh][aiu]t$', word) if m is not None: print m.group() else: print 'not match' 15–2. 匹配用一个空格分隔的任意一对单词,比如,名和姓. from re import match na