Python 3 print without parenthesis

前端 未结 8 1673
一整个雨季
一整个雨季 2020-11-30 01:27

The print used to be a statement in Python 2, but now it became a function that requires parenthesis in Python 3.

Is there anyway to suppress these par

相关标签:
8条回答
  • 2020-11-30 02:16

    You can't, because the only way you could do it without parentheses is having it be a keyword, like in Python 2. You can't manually define a keyword, so no.

    0 讨论(0)
  • 2020-11-30 02:18

    In Python 3, print is a function, whereas it used to be a statement in previous versions. As @holdenweb suggested, use 2to3 to translate your code.

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