cherrypy 给URL传默认参数

code

import random
import string
import cherrypy

class StringGenerator(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"

    @cherrypy.expose
    def generate(self, length=8):
        return ‘‘.join(random.sample(string.hexdigits, int(length)))

if __name__ == __main__:
    cherrypy.quickstart(StringGenerator())

 

 

 

 

 

 

 

 

cherrypy 给URL传默认参数

上一篇:常用的 curl 发送 http 请求 命令


下一篇:JS之给元素添加类的方法