python中在同一个位置输出数据
import sys, time def print_data(): for i in range(5): sys.stdout.write(str(i) + '\r') time.sleep(1) sys.stdout.flush() if __name__ == '__main__': print_data()
import sys, time def print_data(): for i in range(5): sys.stdout.write(str(i) + '\r') time.sleep(1) sys.stdout.flush() if __name__ == '__main__': print_data()