[Tutor] Converting code to string

Luke Paireepinart rabidpoobear at gmail.com
Thu Aug 23 22:56:20 CEST 2007


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"""
>   
Why do you need to do this?  and why within the same module?


More information about the Tutor mailing list