shortest python quine?

后端 未结 10 1751
天涯浪人
天涯浪人 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:47

    Even shorter:

    print(__file__[:-3])
    

    And name the file print(__file__[:-3]).py (Source)

    Edit: actually,

    print(__file__)
    

    named print(__file__) works too.

提交回复
热议问题