I have a string A:
import keyboard
A = "keyboard.press_and_release('left windows+R')"
But, I want it to work as a function. If I call A, then it should press Windows Key and R key present on y keyboard.
I have a string A:
import keyboard
A = "keyboard.press_and_release('left windows+R')"
But, I want it to work as a function. If I call A, then it should press Windows Key and R key present on y keyboard.
Try using eval
. See https://docs.python.org/3.6/library/functions.html#eval
or What does Python's eval() do?
import keyboard
A = "keyboard.press_and_release('left windows+R')"
eval(A)