2 ms·
You don't need these gymnastics of knowing ASCII in Python quines: a = '''a = {} print(a.format(repr(a)))''' print(a.format(repr(a))) (OK, it's no
by eru 2y ago
You don't need these gymnastics of knowing ASCII in Python quines:
a = '''a = {}
print(a.format(repr(a)))'''
print(a.format(repr(a)))
(OK, it's not a quine yet, because the output has slightly different formatting. But the formatting very quickly reaches a fixed point, if you keep feeding it into a Python interpreter.)
The actual quine is the slightly less readable:
a = 'a = {}\nprint(a.format(repr(a)))'
print(a.format(repr(a)))
https://github.com/matthiasgoergens/Quine/blob/c53f187a4b4030437005ddd12bd5a8594269b437/quine.c https://github.com/matthiasgoergens/Quine/blob/c53f187a4b403... has a C quine that doesn't rely on ASCII values either.