0

The code:

input("Type your input here:)

displays as:

Type your input here:

I want to automatically populate the input window with text that can be cleared by pressing backspace so the display looks like:

Type your input here: DEFAULT

and after pressing backspace 3 times the user would see:

Type your input here: DEFA

Other posts have indicated that this isn't something you can do in, say, bash, but is there a way to do this in Python?

DerekG
  • 3,555
  • 1
  • 11
  • 21
  • 1
    Which OS are you using? In the case of Linux please check that this helps: https://stackoverflow.com/questions/2533120/show-default-value-for-editing-on-python-input-possible/2533142#2533142 – Hetal Thaker Mar 12 '21 at 06:00
  • 1
    As @HetalThaker suggested a post, [here](https://pypi.org/project/pyreadline3/) is something for windows similar to that. Hope it helps:) – theProcrastinator Mar 12 '21 at 06:44
  • Thanks @YashvanderBamel looks like this is what I was looking for. Should have looked harder. I'll close this question – DerekG Mar 12 '21 at 06:59

1 Answers1

1

Simple answer: No. It's just not something you can do in a console app. What's commonly done is to display the default you'll get if you press return:

Type your input here [DEFAULT]: 
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30