If I need to print a single newline, what is the most Pythonic way to write the print()
statement? I am teaching someone Python and I want to do it right.
The two ways that I found most likely were:
1) print("")
- Pros: Shorter and more simple
- Cons:
- Might be less readable due to no mention of
\n
- Relies on end being a newline, which may not be inherently obvious
- Might be less readable due to no mention of
2) print("\n", end = "")
- Pros: It is obvious what the statement is meant to do
- Cons: Longer. Beginner might not know what the 'end' argument means.