Hi, It is possible to get bytecode from code object. Reversely, is it possible to create code object from bytecode?
ex. ## python code (not a module) pycode = '''\ print "<ul>\n" for item in items: print "<li>%s</li>\n" % item print "</ul>\n" ''' ## compile it and get bytecode code = compile(pycode, kind='exec') bytecode = code.co_code open('hoge.pyc', 'wb').write(bytecode) ## load bytecode and eval it bytecode = open('hoge.pyc', 'rb').read() code = create_code(bytecode) ## how to ????? output = eval(code, globals, {'items': ['A', 'B', 'C']}) -- regards, kwatch -- http://mail.python.org/mailman/listinfo/python-list