raw strings and \

Fredrik Lundh fredrik at pythonware.com
Mon Mar 6 07:19:39 EST 2006


"Blackbird" <fake at nospam.no> wrote:

> Slightly OT, but here is a crazy little program that shows the power of
> using raw strings:
>
> s=r'print "s=r\'%s\'\n%s"%(s,s)'
> print "s=r\'%s\'\n%s"%(s,s)
>
> When run, this program will print an exact copy of itself.

I'm not sure what the raw strings brings to the table, though; it's not like you need
them to write a "self-replicating" python program:

    http://miscoranda.com/37

</F> 






More information about the Python-list mailing list