Search code examples
pythonpython-3.xsimulationsimulator

printing every thing slowly (Simulate typing)


[printing slowly (Simulate typing)

I got my answer from the link above but it only works when you put the string as a parameter when calling function.

I want the code to print slowly every time when I use print().

is it possible?


Solution

  • Yes, you can do it using the stdout version as below.

    import sys, time
    
    def print(s):
        for letter in s:
            sys.stdout.write(letter)
            time.sleep(.1)
    
    print("Foo")