_=\'_=%r;print _%%_\';print _%_
Is this the shortest possible python quine, or can it be done better? This one seems to improve on all the entrie
Both
print open(__file__).read()
and anything involving import are not valid quines, because a quine by definition cannot take any input. Reading an external file is considered taking input, and thus a quine cannot read a file -- including itself.
For the record, technically speaking, the shortest possible quine in python is a blank file, but that is sort of cheating too.