Skip to content
← Back to Community
How To Use The Getch Module?
Profile icon
SUHASTADIPARTH1

Hi guys,
The title says it all.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
SUHASTADIPARTH1
Comments
hotnewtop
Profile icon
Coder100

is getch python or C?

oh right module that means python

in python,

import getch print("type something: ", end='', flush=True) char = getch.getch() print("you typed in: %s" % (char))

It's quite a simple module I think, you can treat it like input()

Profile icon
SUHASTADIPARTH1

@Coder100 Thank you, It worked.

Profile icon
Coder100
Profile icon
thesneepsnoop

@Coder100 I was unable to import the module :( i get an import error

Profile icon
SUHASTADIPARTH1

@thesneepsnoop Can you show me what your code looks like?

Profile icon
GABELACANLALE

x=getch.getch()
if x=="w"
move_up()
basically a keypress module.