Why does print("…"), i.e. three dots in a row, print blank?
Question:
I’d like to print three dots in a row (to form an ellipsis), but print() prints blank.
print("one moment...")
one moment...
print("...")
print("..")
..
print("...abc...")
abc...
print("u2026")
…
What’s happening here? Why is "…" parsed in an exceptional way?
I am using ipython in PyCharm.
Answers:
Looks like this is a known issue with Pycharm where its interactive console removes the leading three periods from a print statement. Here’s the ticket tracking this issue.
A possible workaround for now is defining something like:
def iprint(obj):
if (s:=str(obj)).startswith("..."):
print(" "+s)
else:
print(s)
which looks like:
>>> iprint("...ymmv")
...ymmv
I’d like to print three dots in a row (to form an ellipsis), but print() prints blank.
print("one moment...")
one moment...
print("...")
print("..")
..
print("...abc...")
abc...
print("u2026")
…
What’s happening here? Why is "…" parsed in an exceptional way?
I am using ipython in PyCharm.
Looks like this is a known issue with Pycharm where its interactive console removes the leading three periods from a print statement. Here’s the ticket tracking this issue.
A possible workaround for now is defining something like:
def iprint(obj):
if (s:=str(obj)).startswith("..."):
print(" "+s)
else:
print(s)
which looks like:
>>> iprint("...ymmv")
...ymmv