I have short piece of code I'm using to print a string to the terminal one letter at a time. It works fine when I invoke the script from within Idle; each letter appears after the preceding one according to the designated time interval. However if I run it in the Mac terminal ('python3 ./script.py'), there's a pause and then the whole string prints in one go. Here's the relevant code:
import sys import time text = "this text is printing one letter at a time..." for char in text: sys.stdout.write(char) time.sleep(0.03) I'm thinking this may be a tty issue (is stdout going to the right terminal?) but I'm still finding my way and would therefore appreciate any guidance. Of course if there's a better way of printing out one letter at a time, I'm also interested to know that. Thanks. P.S. if it's relevant, this is part of a simple financial maths program and it's used to display the results after certain inputs have been gathered. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor