接入流程如下,需要先注册开发者帐号,之后会得到一个32位的key,保存下来,用于以后发送数据。http://www.tuling123.com/
请求方式
示例:
# -*- coding: utf-8 -*-
import urllib
import json
def getHtml(url):
page = urllib.urlo...
分类:
编程语言 时间:
2014-10-26 18:29:28
阅读次数:
332
class Song(object): def __init__(self, lyrics): self.lyrics = lyrics def sing_me_a_song(self): for line in self.lyrics: print linehappy_bda...
分类:
其他好文 时间:
2014-10-26 12:59:54
阅读次数:
134
var Deferred = require('er/Deferred');var def = new Deferred(); def.then( function () { console.log('b') }).then( function () { ...
分类:
其他好文 时间:
2014-10-25 21:18:55
阅读次数:
228
nova/api/openstack/__init__.pyAPIRouter类:def __init__(self, ext_mgr=None, init_only=None): if ext_mgr is None: if self.ExtensionManager: ...
class UserDetails(Form): group_id = SelectField(u'Group', coerce=int)def edit_user(request, id): user = User.query.get(id) form = UserDetails...
分类:
其他好文 时间:
2014-10-25 17:17:02
阅读次数:
129
装饰器是一个很著名的设计模式,经常被用于有切面需求的场景,较为经典的有插入日志、性能测试、事务处理等。装饰器是解决这类问题的绝佳设计,有了装饰器,我们就可以抽离出大量函数中与函数功能本身无关的雷同代码并继续重用。概括的讲,装饰器的作用就是为已经存在的对象添加额外的功能。
假如我要计算一个函数的执行时间:
import time
def foo():
print 'in foo...
分类:
编程语言 时间:
2014-10-24 23:41:22
阅读次数:
516
利用可达矩阵的幂来判断是否可达#include #include #include #include #include #include #include #include #include #include using namespace std; #define MP make_pair#def...
分类:
其他好文 时间:
2014-10-24 20:31:46
阅读次数:
241
记得在cocoa中也有property的概念,python中的property与cocoa里的property好像是差不多的。下面是它的两种用法。用法一:class test(object): def __init__(self): print "init is calling"...
分类:
编程语言 时间:
2014-10-24 18:05:25
阅读次数:
239
def log(func):
def wrapper(*args,**kw):
print 'call %s():'%func.__name__
return func(*args,**kw)
return wrapper
@log
def now():
print 'hello!'
now()...
分类:
其他好文 时间:
2014-10-24 14:47:24
阅读次数:
149
from sys import argvscript, input_file = argvdef print_all(f): print f.read() def rewind(f): f.seek(0)def print_a_line(line_count, f): pri...
分类:
其他好文 时间:
2014-10-24 10:25:01
阅读次数:
253