#!/usr/bin/env python import time import sys print 'Hello world! --> Python 2' sys.stdout.flush() print("Hello world! --> Python 3") sys.stdout.flush() time.sleep(1) for i in range(5): print '%d --> Python 2' % i sys.stdout.flush() print("%d --> Python 3") % i sys.stdout.flush() time.sleep(1)