'Waiting' animation in command prompt (Python)

Just another pretty variant

import time

bar = [
    " [=     ]",
    " [ =    ]",
    " [  =   ]",
    " [   =  ]",
    " [    = ]",
    " [     =]",
    " [    = ]",
    " [   =  ]",
    " [  =   ]",
    " [ =    ]",
]
i = 0

while True:
    print(bar[i % len(bar)], end="\r")
    time.sleep(.2)
    i += 1

Use \r and print-without-newline (that is, suffix with a comma):

animation = "|/-\\"
idx = 0
while thing_not_complete():
    print(animation[idx % len(animation)], end="\r")
    idx += 1
    time.sleep(0.1)

For Python 2, use this print syntax:

print animation[idx % len(animation)] + "\r",