-1

I'm trying to run an instruction continuosly and only when I press "e" the loop must stop, the code is:

while True:
    Code = "Hello world"
    print(Code)
    if keyboard.read_key() == "e":
        break

The problem I get is that only when I press another key (not "e") on the keyboard it prints "hello world" but I want the code to print it even if I don't press anything

1 Answers1

1

The point is that keyboard.read_key() is waiting for you to insert a key, think at it as an input

std124_lf
  • 134
  • 2
  • 9