您的位置:首页 > 编程语言 > Python开发

调入源代码运行的python

2008-11-26 12:00 218 查看
#coding=utf-8

import sys, os, time, traceback, types

source = "#coding=utf-8/n/n"
source += "print 'hello world!' /n"
source += "print 'hello!' /n"
source += "print u'您好!' /n"

description = ""

mod = None

code = compile(source, description, "exec")
exec code #in mod
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: