摘要:
在Windows7x64下使用pip安装包的时候提示报错:error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27原因:window... 阅读全文
摘要:
keys = ['Name', 'Sex', 'Age']values = ['Tim', 'Male', 23] dic = dict(zip(keys, values))#{'Age': 23, 'Name': 'Tim', 'Sex': 'Male'} 阅读全文
摘要:
numList = [1,2,3,4,5] sum = sum(numList) #sum = 15maxNum = max(numList) #maxNum = 5minNum = min(numList) #minNum = 1from operator import mulprod =... 阅读全文
摘要:
strList = ["Python", "is", "good"] res = ' '.join(strList) #Python is good res = ''for s in strList: res += s + ' '#Python is good #最后还有个多余空格 阅读全文
摘要:
def reverse_str( s ): return s[::-1] def reverse_str( s ): t = '' for x in xrange(len(s)-1,-1,-1): t += s[x] return t 阅读全文
摘要:
asyncore库是python的一个标准库,它是一个异步socket的包装。我们操作网络的时候可以直接使用socket等底层的库,但是asyncore使得我们可以更加方便的操作网络,避免直接使用socket,select,poll等工具时需要面对的复杂。这个库很简单,包含了一个函数和一个类:* l... 阅读全文
摘要:
安装pip:apt-get install python-setuptoolseasy_install pippip install xxxx 阅读全文
摘要:
import os import socketimport threadingimport SocketServerSERVER_HOST = 'localhost'SERVER_PORT = 0 #tells the kernel to pick up a port dynamicallyBUF_... 阅读全文
摘要:
Exception happened during processing of request from ('127.0.0.1', 65066)Traceback (most recent call last): File "C:\Python27\lib\SocketServer.py", l... 阅读全文
摘要:
Server:import socketimport sysimport argparsehost = 'localhost'data_payload = 2048backlog = 5def echo_server(port): '''A simple echo server''' #Create... 阅读全文