I've been trying to print out the progress of a for loop in python2.7 using the following code:

```
for i in range(100):
    if float(i) % 10.0 == 0:
        print i, "\r",

```

The behaviour I'm after is the refreshing of the same line on std out rather than writing to a new line every time.

EDIT 1:

Testing in my console (Xfce Terminal 0.4.8), I actually don't get any output regardless of whether I include the `if` statement or not.

**Why is there no output?**

I originally said the behaviour of the stdout changed depending on the if statement being there or not because I simplified the code that produced the problem to its most simple form (only to produce the above mentioned effect). My apologies.

EDIT 2:

Thanks to [senderle](https://stackoverflow.com/a/10552693/1358677), this is solved. If you miss out the `sleep()` command, the prints and carriage return happen so quickly you can't see them.

EDIT 3:

One last thing. If you don't catch for the final number in `range(100)`, i.e. 99, the number is cleared off the screen.

EDIT 4:

Note the comma after `print i` in [senderle](https://stackoverflow.com/a/10552693/1358677)'s answer.