shortest python quine?

后端 未结 10 1792
天涯浪人
天涯浪人 2020-12-23 19:55
_=\'_=%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

10条回答
  •  死守一世寂寞
    2020-12-23 20:30

    Technically, the shortest Python quine is the empty file. Apart from this trivial case:

    Since Python's print automatically appends a newline, the quine is actually _='_=%r;print _%%_';print _%_\n (where \n represents a single newline character in the file).

提交回复
热议问题