import re q='"' s='\\' nl='\n' x="import re\"+nl+\"q='\"+q+\"'\"+nl+\"s='\"+s+s+\"'\"+nl+\"nl='\"+s+\"n'\"+nl+\"x=\"+q+re.sub('\"',s+'\"',x)+q+nl+\"print \"+q+x" print "import re"+nl+"q='"+q+"'"+nl+"s='"+s+s+"'"+nl+"nl='"+s+"n'"+nl+"x="+q+re.sub('"',s+'"',x)+q+nl+"print "+q+x
Hey, I didn’t say it was pretty. Note how the syntax highlighter completely throws in the towel by line 3. :(