-1

This is a python2 script how can i use this on python3

import sys

for x in range(10000):

    print "HAPPY >> %s <<\r" % str(x),
    sys.stdout.flush()
tzaman
  • 46,925
  • 11
  • 90
  • 115

1 Answers1

1

Idiomatic Python 3 would use the end and flush parameters to the print function, along with an f-string:

for x in range(10000):
    print(f"HAPPY >> {x} <<", end="\r", flush=True)
tzaman
  • 46,925
  • 11
  • 90
  • 115