Quine in Python
I’ve been trying to hone my Python skills. Python has lots of nice commands for manipulating text, including standard libraries for doing base64 encoding. After a few abortive tries, I came up with.
#!/usr/bin/env python data=""" aWYgX19uYW1lX18gPT0gJ19fbWFpbl9fJzoKICAgIGltcG9ydCBzeXMsIGJhc2U2NAogICAgc3lz LnN0ZG91dC53cml0ZSgnIyEvdXNyL2Jpbi9lbnYgcHl0aG9uXG5kYXRhPSIiIicrZGF0YSsnIiIi XG4nKQogICAgc3lzLnN0ZG91dC53cml0ZShiYXNlNjQuZGVjb2Rlc3RyaW5nKGRhdGEpKQo= """ if __name__ == '__main__': import sys, base64 sys.stdout.write('#!/usr/bin/env python\ndata="""'+data+'"""\n') sys.stdout.write(base64.decodestring(data))
(You can download the code directly from here.) It’s very similar to one of my early C quines, but significantly shorter, and somewhat easier to follow.
For other good links on quines, try this page of quines, or perhaps this list of quines in many programming languages.
I suspect the world would be better if that percentage were even greater.
Apparently 15% of all web traffic is cat related. There's no reason for Brainwagon be any different.
Thanks Mal! I'm trying to reclaim the time that I was using doom scrolling and writing pointless political diatribes on…
Brainwagons back! I can't help you with a job, not least because I'm on the other side of our little…
Congrats, glad to hear all is well.