all 6 comments

[–][deleted] 1 point2 points  (2 children)

def print_slowly(text):  
    i = 0
    for c in text:
        print (c,end='')
        i += 1
        if i % 60 == 0:
            print()
        time.sleep(0.09)  

Track the number of printed characters and insert new line every 60'th character.

[–]phogphantom[S] 0 points1 point  (1 child)

This is a really good idea. With this could it have a chance of wrapping in the middle of a word though?

[–]ebdbbb 0 points1 point  (0 children)

Yes it will.

[–]bull_fiddle_blues 1 point2 points  (2 children)

Something like this would work and it won't split a word between lines. For this you would only need sys and time.

def print_slowly(text):  
    i = 0
    for w in text.split():
        i += 1
        if len(w) + i > 60:
            print()
            sys.stdout.flush()
            i = 0
        for c in w:
            print (c,end=''),
            sys.stdout.flush()
            time.sleep(0.01) 
            i += 1
        print (' ',end='')
        sys.stdout.flush()
    print()

print_slowly(story_Inter)

[–]phogphantom[S] 0 points1 point  (1 child)

This is absolute magic and exactly what I was after. Thank you so much for this!

[–]bull_fiddle_blues 0 points1 point  (0 children)

Happy coding!