Alex Rivera | Logout

command line in python with history

Asked 2013-03-14T17:23:42.153
16

I'm writing program in python in which user is to work with program by command-line. I'm using raw_input to get command from user. I want to have "memory" like in bash, etc, so, if you press an arrow (up or down) on your keyboard, you get previous/next command. I know about one way to do it (simply get every char typed by user and check it), but maybe you know something better / cuter :-)

greetings

Edit
Report

1 Answer

6

The built-in readline module provides this functionality.

answered 2013-03-14T17:28:52.763

Your Answer