zopeplonepylonsweb2pycherrypywebware:web框架 pyjamas soap:web service Ironpython 1 socket(AF_INET,SOCK_STREAM) SOCK_DGRAM AF_UNIF sobj.bind() sobj.listen con,dre=sobj.accept() con.receive() con.send() con.close() socket(xx) sobj.connect() sobj.send() sobj.recv() 2 返回字符串列表中的最长长度: labelsize = max(len(x) for x in labels) 2 3 if input("xx") in ['y','Y']: 4 urllib.request.urlretrieve(remoteaddr,localfilename) 从远端地址下载文件存储到localfilename 5、ftp.retrbinary二进制方式下载,retrlines文本方式下载 6、localdir=(len(sys.argv)>1 and sys.argv[1]) or '.' ###传参默认值 localdir = (len(sys.argv) > 1 and sys.argv[1]) or '.' cleanall = input('Clean local directory first? ')[:1] in ['y', 'Y'] ##获取用户输入 7、删除文件夹: for localname in os.listdir(localdir): # try to delete all locals try: # first, to remove old files print('deleting local', localname) # os.listdir omits . and .. os.remove(os.path.join(localdir, localname)) except: print('cannot delete local', localname) 8、 from mimetypes import guess_type mimetype,encoding=guess_type(filepath) mimetype=mimetype or "?/?" maintype = mimetype.split('/')[0] 9、收取邮件:
image.png
image.png
10、email.utils 邮件发送中的日期格式:
image.png
11、发送邮件:
image.png
12、mimetype
mimetypes.guess_type(filename) xxx.txt--> text/plain
mimetypes.guess_extension(contype) text/plain-->xxx.txt
13、email.message
image.png
parser
image.png
14、发送带附件邮件:
image.png
接收邮件解析:
image.png
15、http.client.HTTPConnection
16 urllib.request.urlopen
17