cherrypy 给URL传默认参数

时间:2020-12-23 16:56:32   收藏:0   阅读:30

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())

 

 

 

 

 

 

 

 

原文:https://www.cnblogs.com/sea-stream/p/14179073.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!