import pygame.midi as md import os import time md.init() mseconds = 0 output = open('pygame-alone.txt', 'w') while mseconds < 10000: mseconds = md.time() output.write('%f%s' % (mseconds, os.linesep)) # print mseconds time.sleep(0.01) output.close()