Python Forum
How to recognize space or enter as one-character input?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to recognize space or enter as one-character input?
#3
(Oct-17-2019, 03:44 PM)ichabod801 Wrote: The input function returns what the user typed up to but not including the final enter. So if they just hit enter, and empty string ('') will be returned. If they hit space + enter, a space character will be returned (' ').

If they just hit space without hitting enter, input will sit there waiting for them to hit enter.

Is there an altogether different command that solicits input and records it without the "final enter?"

I've seen programs in the past (language unknown) that will say things like "enter Y or N" and proceed once that first keystroke (Y or N) is pressed. That's what I'm trying to do.
Reply


Messages In This Thread
RE: How to recognize space or enter as one-character input? - by Mark17 - Oct-17-2019, 05:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python rule about the space character surrounding the equal sign ineuw 10 1,791 Sep-21-2023, 09:17 AM
Last Post: ineuw
  python cant recognize PIP siubikYT 2 823 Jul-19-2023, 06:30 PM
Last Post: Lahearle
  How to split the input taken from user into a single character? mHosseinDS86 3 1,239 Aug-17-2022, 12:43 PM
Last Post: Pedroski55
  Is it possible to make a program recognize how many clicks it has had on the monitor? jao 0 1,183 Feb-25-2022, 06:31 PM
Last Post: jao
  My program won't recognize the filename. braingoblins 1 1,176 Jan-07-2022, 06:18 PM
Last Post: deanhystad
  [solved] unexpected character after line continuation character paul18fr 4 3,526 Jun-22-2021, 03:22 PM
Last Post: deanhystad
Star NameError – function doesn't recognize imported modules Sir 4 3,608 Dec-01-2020, 06:36 AM
Last Post: Sir
  from global space to local space Skaperen 4 2,383 Sep-08-2020, 04:59 PM
Last Post: Skaperen
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,235 Jul-13-2020, 07:05 PM
Last Post: snippsat
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,795 Jan-05-2020, 11:50 AM
Last Post: vivekagrey

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020