Console typing

This is the place for queries that don't fit in any of the other categories.

Console typing

Postby Ville » Thu Apr 04, 2013 1:48 pm

Hi
I want that my code gives text to my console but every letter should come with a little delay. I've tried something like this:
Code: Select all
from time import sleep
print "H", sleep(0.1), "e", sleep(0.1), "l", sleep(0.1), "l", sleep(0.1), "o"

but it keeps butting random "None":s ... Help please :?:
Ville
 
Posts: 2
Joined: Thu Apr 04, 2013 1:19 pm

Re: Console typing

Postby setrofim » Thu Apr 04, 2013 3:53 pm

Code: Select all
from time import sleep

for c in "Hello":
   print c,
   sleep(0.1)
print
setrofim
 
Posts: 288
Joined: Mon Mar 04, 2013 7:52 pm

Re: Console typing

Postby Yoriz » Thu Apr 04, 2013 3:54 pm

Hi
The nones are not random, you are getting one none for every sleep.
The calls to sleep are inside of the print so it prints the result of the call to sleep which is none.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 833
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: Console typing

Postby Ville » Thu Apr 04, 2013 6:33 pm

Okey, thank you very much :D
Ville
 
Posts: 2
Joined: Thu Apr 04, 2013 1:19 pm


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 5 guests