RPC属于函数级别的远程调用,它通常是通过HTTP传输数据,数据形式有XML、JSON、序列化数据等。在此,用python做一个xml-rpc的示例。首先给出服务器端server.py:from SimpleXMLRPCServer import SimpleXMLRPCServer def tes...
分类:
其他好文 时间:
2014-06-27 00:47:07
阅读次数:
326
def say(a,b):print a,b---》apply(say,('jenny','hui'))jenny hui
分类:
编程语言 时间:
2014-06-26 23:24:36
阅读次数:
236
def ghi abc def ghi当tr的display:block时,colspan会失效,所以一般遇到table需要设置tr为block时,改为“table-row”即可。运用在这个案例中.
分类:
其他好文 时间:
2014-06-26 22:13:49
阅读次数:
715
我们知道通过TCP协议发送接收数据时,如果数据过大,接受到的数据会是分包的,比如:
+-----+-----+-----+
发送数据是: | ABC | DEF | GHI |
+-----+-----+-----+
而我们想接受到...
分类:
Web程序 时间:
2014-06-26 13:11:28
阅读次数:
159
【问题】
Given n points
on a 2D plane, find the maximum number of points that lie on the same straight line.
【思路】
对每一个点,分别计算这个点和其他所有点构成的斜率,具有相同斜率最多的点所构成的直线,就是具有最多点的直线。
【代码】
class Point:
def __in...
分类:
编程语言 时间:
2014-06-25 19:34:29
阅读次数:
246
刚学python,学到了有关于类和对象的地方。对一个概念有点模糊,后来通过实践编码找到一定规律
在python中
class test(object):
id=2
name='tt' list=['tt','dd']
def change(self,newA,new_id):
self.id=new_id
self.age=new...
分类:
编程语言 时间:
2014-06-25 19:29:20
阅读次数:
267
Chapter1 and Chapter2方法定义:def methodName(param1: ParamType, param2: ParamType2, [maybe more]): ReturnType = { // method body}函数式编程中一个约定俗成的说法就是,方法会返回一....
分类:
其他好文 时间:
2014-06-25 19:15:35
阅读次数:
205
python解释器将__init__函数里的__z变量转成 _classname__z了,明确规则后外部依旧能够通过实力对象来訪问。In [1]: class aa: ...: def __init__(self): ...: self.x = 10 ...: ...
分类:
编程语言 时间:
2014-06-25 16:12:09
阅读次数:
211
def upload(url,params):
'''
上传文件到服务器,不适合大文件
@params url 你懂的
@params {"action":"xxx","@file","file_path"} 普通参数 key:value 文件key头部加@
'''
import os
import urllib2
BOUNDAR...
分类:
编程语言 时间:
2014-06-25 06:50:59
阅读次数:
298
一:勘误
classifier类中: def fprob(self, f, cat):
if self.catcount(cat) == 0:
return 0
#notice: rember change int to double or float
# + 0.0 or *1.0 is ok, other wise, may get 0.
return self.fc...
分类:
其他好文 时间:
2014-06-24 17:49:42
阅读次数:
211