import sys code = """import datetime print 'This is a pile of arbitrary code to execute' print sys.argv print datetime.datetime.now()"""
if len(sys.argv) > 2: exec(code) else: print "Fooless" --Michael On Feb 18, 2008 5:17 PM, Scott Wolcott <[EMAIL PROTECTED]> wrote: > Okay, I've got this ircbot that i wrote in python, and while we were all > making Terminator jokes, it occurred to me that it would actually be > reletively easy to have redqueen (that's the bot) write code into another > file. Then you just have to specify the file and import the code and run it. > It sounds possible, but there are a couple of things i'm not sure how to do. > > The biggest problem is I'm not sure how to run the external code. Does > anyone know of good way to do this, or can someone just point me in the > right direction? > > -Scott > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Michael Langford Phone: 404-386-0495 Consulting: http://www.RowdyLabs.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor