Skip to content

Instantly share code, notes, and snippets.

@quantumelixir
Created January 15, 2011 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quantumelixir/780822 to your computer and use it in GitHub Desktop.
Save quantumelixir/780822 to your computer and use it in GitHub Desktop.
Some quines I made in Python
#Quine1
e=r'''print "e=r''"+"'"+e+"''"+"'\n"+e'''
print "e=r''"+"'"+e+"''"+"'\n"+e
#Quine2
x='%s=%s;print x%%("x",chr(39)+x+chr(39))';print x%("x",chr(39)+x+chr(39))
#Quine3
y="%"
z='y="%s"\nz=%s\nprint z%s(y,repr(z),y)'
print z%(y,repr(z),y)
#Quine0 (Try this in the IDLE python shell)
#SyntaxError: invalid syntax
##Cheating
#import os
#print open(os.path.abspath('')+'/'+__file__).read()[:-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment