Search code examples
pythonpython-3.xpynput

Can pynput be used with variables?


What im trying to accomplish is that x would be set to a number and after a loop with start and after the end of a loop x would be +1. but i cant get pynput to type integers. is there anyway i could use pynput to do this?

enter image description here


Solution

  • Just cast x to a string in the function call. For example,

    for x in range(15):
        keyboard.type(str(x))