title: Getting python to respond to a specific key press
body: <p>I am trying to create a program that reads the text from a text file line by line. For the first 3 lines, the user simply needs to press enter to advance to the next line. For the fourth line, however, they need to press a specific key (the letter "u" in this case). I tried doing this using getch(), but for some reason pressing the "u" key does not generate any response. Here is the code:</p>
  
  <pre><code>from os import path
  from msvcrt import getch
  trial = 1
  while trial &lt; 5:
      p = path.join("C:/Users/Work/Desktop/Scripts/Cogex/item",  '%d.txt') % trial
      c_item = open(p) 
      print (c_item.readline())
      input()
      print (c_item.readline())
      input()
      print (c_item.readline())
      input()
      print (c_item.readline())
      if ord(getch()) == 85:
          print (c_item.readline())
          input()
  trial += 1
  </code></pre>
  
  <p>I've also read about people using pygame or Tkinter, but I don't know if it is possible to use these without having the program use a graphical interface. Thanks in advance!</p>