Bernard Lebel wrote: > Hello, > > I'm looking for a way to convert Python code into a string. > > For example, let say I have this function: > > def myFunc(): > print 'hello world' > > > Now in the same module, I'd like to take this function and convert it > into a string: > > """def myFunc(): > print 'hello world'\n"""
Try inspect.getsource(myFunc). But why? Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor