Thursday 12 July 2018

Python Trailing Commas

Cited from Python trailing comma after print executes next instruction

In Python 2.x, a trailing , in a print statement prevents a new line to be emitted.
  • In Python 3.x, use print("Hi", end="") to achieve the same effect.

No comments:

Post a Comment