最赞回答 / 慕桂英0574841
①TCPServer、②UDPServer、③UnixStreamServer、④UnixDatagramServer四种网络服务器为一类, 多进程①ForkingMixin 和 多线程②ThreadingMixin两种服务器运行模式为一类。排列组合,列如:多进程ForkingMixin、TCPServer网络服务器,多进程ForkingMixin、UDPServer网络服务器,11 , 21 , 31 , 41 ,21 ,22 , 23 , 24 八种
2019-04-06
import math
def is_sqr(x):
c=(x/(round(math.sqrt(x)))==math.sqrt(x))
return x and c
print filter(is_sqr, range(1,100))
def is_sqr(x):
c=(x/(round(math.sqrt(x)))==math.sqrt(x))
return x and c
print filter(is_sqr, range(1,100))
2019-04-04
def count():
fs = []
for i in range(1, 4):
def f(x=i):
return x*x
fs.append(f)
return fs
f1, f2, f3 = count()
print f1(), f2(), f3()
fs = []
for i in range(1, 4):
def f(x=i):
return x*x
fs.append(f)
return fs
f1, f2, f3 = count()
print f1(), f2(), f3()
2019-04-03
class Person(object):
def __init__(self, name, gender, **kw):
self.name = name
self.gender = gender
for k, v in kw.iteritems():
setattr(self,k,v)
p = Person('Bob', 'Male', age=18, course='Python')
print p.age
print p.course
def __init__(self, name, gender, **kw):
self.name = name
self.gender = gender
for k, v in kw.iteritems():
setattr(self,k,v)
p = Person('Bob', 'Male', age=18, course='Python')
print p.age
print p.course
2019-04-03
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
2019-04-03