-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
  • 44,771
  • 11
  • 88
  • 112

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
  • 44,771
  • 11
  • 88
  • 112