gert <gert.cuyk...@gmail.com> writes: > I would like to read the following from a text file > > from json import loads > from gert.db import Db > def application(environ, response): > v = loads(environ['wsgi.input'].read(int(environ > ['CONTENT_LENGTH'])).decode('utf-8')) > db = Db() > db.execute('UPDATE votes SET count=count+1 WHERE vid=?',(v > ['vid'],)) > db.execute('SELECT * FROM votes') > j = '{"rec":'+db.json()+',\n' > j+= ' "des":'+db.jdes()+'}' > j = j.encode('utf-8') > response('200 OK', [('Content-type', 'text/ > javascript;charset=utf-8'), ('Content-Length', str(len(j)))]) > return [j] > > execute it, and wrap a new function name around it for example > > def wrapper(environ, response): > exec(file) > return application(environ, response) > > How do I do this in python3?
What's wrong with importing it? -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list