Created
May 28, 2012 07:15
-
-
Save localredhead/2817802 to your computer and use it in GitHub Desktop.
Python quine(not quite)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counted_quine(): | |
"""This function has been quined 0 times""" | |
copy=[ | |
"def counted_quine():", | |
"This function has been quined 0 times", | |
"copy=[", | |
"print(copy[0])", | |
"for i in range(1,2):", | |
" print(" " + chr(34)*3 copy[i].replace(''.join(i for i in counted_quine.__doc__ if i.isdigit()), str(int(''.join(i for i in counted_quine.__doc__ if i.isdigit()))++1)) + '\"\"\"')", | |
"print(\" \" + copy[2])", | |
"print(\" \"*2 + '\"' + copy[0] + '\"' + ',')", | |
"for i in range(1,2):", | |
" print(\" \"*2 + '\"' + copy[i].replace(''.join(i for i in counted_quine.__doc__ if i.isdigit()), str(int(''.join(i for i in counted_quine.__doc__ if i.isdigit()))++1)) + '\"' + ',')", | |
"for i in range(2, len(copy)-1):", | |
" print(\" \"*2 + '\"' + copy[i] + '\"' + ',')", | |
"print(\" \" + ' ]')", | |
"for i in range(3, len(copy)-1):", | |
" print(\" \" + copy[i])", | |
"print(copy[len(copy)-1])", | |
"counted_quine()" | |
] | |
print(copy[0]) | |
for i in range(1,2): | |
print(chr(34)+' '*4+chr(34)+chr(34)*3 + copy[i].replace(''.join(i for i in counted_quine.__doc__ if i.isdigit()), str(int(''.join(i for i in counted_quine.__doc__ if i.isdigit()))++1)) + chr(34)*3 ) | |
print(" " + copy[2]) | |
print(" "*2 + chr(34) + copy[0] + chr(34) + ',') | |
for i in range(1,2): | |
print(" "*2 + chr(34) + copy[i].replace(''.join(i for i in counted_quine.__doc__ if i.isdigit()), str(int(''.join(i for i in counted_quine.__doc__ if i.isdigit()))++1)) + chr(34) + ',') | |
for i in range(2, len(copy)-1): | |
print(" "*2 + chr(34) + copy[i] + chr(34) + ',') | |
print(" "*2 + chr(34) + copy[len(copy)-1] + chr(34)) | |
print(" " + ' ]') | |
for i in range(3, len(copy)-1): | |
print(" " + copy[i]) | |
print(copy[len(copy)-1]) | |
counted_quine() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment