How to print without a newline or space

Example in C:

for (int i = 0; i < 4; i++)
    printf(".");

Output:

....

In Python:

>>> for i in range(4): print('.')
.
.
.
.
>>> print('.', '.', '.', '.')
. . . .

In Python, print will add a \n or space. How can I avoid that? I’d like to know how to “append” strings to stdout.

2
24

Leave a Comment