Hi,

a simple question: how do I enable deleting inside a python program?

I have a python program that asks for user input, users write some words and then press enter. The problem is they can't use backspace or supr to delete anything, instead, the program prints ^? each time they press backspace. Any ideas?


I use python 3.x and the readline libraries are working perfectly in the terminal program I use for running these scripts.


thank you

Your running environment is Linux?

What readline functions are you using? Some piece of example code, maybe?

Have you tried the curses support?

Curses Programming with Python

Data point:
(Python 3.1.2, OS/X latest)
From the command line I invoked python3 and entered this code print(input("What: ")) All the usual cursor controls worked for me: Delete, emacs-style commands (^A ^B, ^D ^E and ^F), arrows all did as I expected.

Yes, you are right. The problem was in the terminal program I was using, not python. I solved it by switching to Konsole.


Thank you all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.