我认为您不必为web.py做任何“特别”的事情来提供JSON。
import webimport jsonclass index: def GET(self): pyDict = {'one':1,'two':2} web.header('Content-Type', 'application/json') return json.dumps(pyDict)
我认为您不必为web.py做任何“特别”的事情来提供JSON。
import webimport jsonclass index: def GET(self): pyDict = {'one':1,'two':2} web.header('Content-Type', 'application/json') return json.dumps(pyDict)