Tell if Python is in interactive mode

后端 未结 7 976
北荒
北荒 2020-11-28 10:03

In a Python script, is there any way to tell if the interpreter is in interactive mode? This would be useful so that, for instance, when you run an interactive Python sessio

相关标签:
7条回答
  • 2020-11-28 11:07

    sys.ps1 and sys.ps2 are only defined in interactive mode.

    0 讨论(0)
提交回复
热议问题