I want a text to be displayed as if it is just being typed. So I need a little delay after every letter.
I tried to do it this way:
import time
text = "Hello, this is a test text to see if all works fine."
for char in text:
print char,time.sleep(0.2),
It works fine, except for one problem. I get a "None" after every character.
This is the output:
H None e None l None l None o None , None None t None h None i None s None None i None s None None a None None t None e None s None t None None t None e None x None t None None t None o None None s None e None e None None i None f None None a None l None l None None w None o None r None k None s None None f None i None n None e None . None
I don't know why this happens. I hope anyone can help me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…