In Python what's the best way to emulate Perl's __END__?

后端 未结 6 1685
醉酒成梦
醉酒成梦 2021-01-17 07:38

Am I correct in thinking that that Python doesn\'t have a direct equivalent for Perl\'s __END__?

print \"Perl...\\n\";

__END__
End of code. I c         


        
6条回答
  •  隐瞒了意图╮
    2021-01-17 07:49

    What you're asking for does not exist. Proof: http://www.mail-archive.com/python-list@python.org/msg156396.html

    A simple solution is to escape any " as \" and do a normal multi line string -- see official docs: http://docs.python.org/tutorial/introduction.html#strings

    ( Also, atexit doesn't work: http://www.mail-archive.com/python-list@python.org/msg156364.html )

提交回复
热议问题