I am using Python 2.6 and I want to know how I can use the console key. At the moment, I do not want to use Tkinter or another graphics library.
Below is my code.
history=[] while(1): try: cmd = self.get_cmd() history.append(cmd) # append user command # if i press UP key, just display history. # i'll you for statement to disaply history. print "%s" %history
For your purposes, you can look at the readline module designed for things like history processing, etc. This is the standard python library, so this may be what you need. And with another rlcompleter module , you can even handle autocomplete.
Source: https://habr.com/ru/post/1447464/More articles:syntax error in creating trigger, what's wrong? - mysqlIs it possible to get the iQSI initiator of the IQN of another Linux machine? - linuxHow to make the client a spray client to follow forwarding - redirectIs it possible to link the value with the Application Settings file directly to the CSS stylesheet? - c #Play reverse routing 2.1-RC1 without compiling - scalaImplicit arguments and applying a function to the tail of fixed size vectors - dependent-typeCan I use instance variables created for auto-synthesized properties? - propertiesHow to customize Pandas columns to align columns of data by subindex? - pythontcpdump: source and destination addresses only - bashC # dynamic getter and setter depending on application context - functionAll Articles