cherrypy - URL dispatcher [duplicate]
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Using mappings in CherryPy How would I map a url regEx such as /data/[A-Z].txt to a resource in cherrypy? Is there an simple example somewhere? I don't get the docs here. http://tools.cherrypy.org/wiki/RestfulDispatch 回答1: You could use a RoutesDispatcher import cherrypy class City: def __init__(self, name): self.name = name self.population = 10000 @cherrypy.expose def index(self, **kwargs): return "Welcome to