Ask coding questions

← Back to all posts
checking input
h
XanthusPettitt (7)

I want to check an input without having to enter how might I do this?
like if you input "d" I don't want to press enter I want to just enter d and the "X" will move

Answered by LukeWright (114) [earned 5 cycles]
View Answer
Comments
hotnewtop
LukeWright (114)

you could use getch

XanthusPettitt (7)

@LukeWright ok thank you lemme find out how to select your comment rq

LukeWright (114)

just press the checkmark next to my comment @XanthusPettitt

Coder100 (17021)

using getch.
Its really easy and breaks almost nothing

from getch import getch

print('ay yo press something', end='')
print('check: you typed', getch())
DavidSafro (19)

what do you mean check an input without having to enter

XanthusPettitt (7)

@DavidSafro like if you input "d" I don't want to press enter I want to just enter d and the "X" will move