Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text, one letter at a time
#8
(Oct-31-2016, 10:01 PM)MACA Wrote: Wait, wait, wait. How would I use
 time.sleep(0.1) 
with the
 def textType 
function?

Like if I used it this way:

for ch in text:
    print (ch)
    time.sleep(0.1)

textType("Hello Everybody!", 0.1)
Hello!
The default behavior of print() functions is to add \n - a new line - character at the end of the printed text. So the next printed text will be printed bellow.
print(ch, end="")
will fix it. The default is end="\n"
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
Text, one letter at a time - by MACA - Oct-31-2016, 08:48 PM
RE: Text, one letter at a time - by micseydel - Oct-31-2016, 08:50 PM
RE: Text, one letter at a time - by MACA - Oct-31-2016, 08:51 PM
RE: Text, one letter at a time - by micseydel - Oct-31-2016, 08:58 PM
RE: Text, one letter at a time - by MACA - Oct-31-2016, 08:59 PM
RE: Text, one letter at a time - by MACA - Oct-31-2016, 10:01 PM
RE: Text, one letter at a time - by wavic - Nov-01-2016, 11:21 AM
RE: Text, one letter at a time - by snippsat - Oct-31-2016, 10:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  More elegant way to remove time from text lines. Pedroski55 6 4,177 Apr-25-2021, 03:18 PM
Last Post: perfringo
  Split gps files based on time (text splitting) dervast 0 1,966 Nov-09-2020, 09:19 AM
Last Post: dervast
  [Help] How to count Letter frequency in a text file? vanicci 6 15,932 Aug-08-2018, 12:23 PM
Last Post: vanicci

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020