<s>[INST] How to print in Python without newline or space? The question is in the title.
I'd like to do in  python what I do in this example in c:
#include <stdio.h>

int main() {
    int i;
    for (i=0; i<10; i++) printf(".");
    return 0;
}

Output:
..........

In Python:
>>> for i in xrange(0,10): print '.'
.
.
.
.
.
.
.
.
.
.
>>> for i in xrange(0,10): print '.',
. . . . . . . . . .

In Python print will add a \n or a space, how can I avoid that? Now, it's just an example. Don't tell me I can first make a string then print it. I'd like to know how to "append" strings to the stdout (I don't know if it's worded correctly).
 [/INST] General way
import sys
sys.stdout.write('.')

You may also need to call
sys.stdout.flush()

to ensure stdout is flushed immediately.
Python 2.6+
From Python 2.6 you can import the print function from Python 3:
from __future__ import print_function

This allows you to use the Python 3 solution below.
Python 3
In Python 3, the print statement has been changed into a function. In Python 3, you can instead do:
print('.', end="")

This also works in Python 2, provided that you've used from __future__ import print_function.
If you are having trouble with buffering, you can flush the output by adding flush=True keyword argument:
print('.', end="", flush=True)

 </s>