How to repeat last command in python interpreter shell?

后端 未结 26 1027
一个人的身影
一个人的身影 2020-11-29 16:43

How do I repeat the last command? The usual keys: Up, Ctrl+Up, Alt-p don\'t work. They produce nonsensical characters.

(ve)[kakarukeys@localhost ve]$ python
         


        
相关标签:
26条回答
  • 2020-11-29 17:09

    Ctrl+p is the normal alternative to the up arrow. Make sure you have gnu readline enabled in your Python build.

    0 讨论(0)
  • 2020-11-29 17:11

    I find information that I copied below answer the question

    Adapt yourself to IDLE: Instead of hitting the up arrow to bring back a previous command, if you just put your cursor on the previous command you want to repeat and then press "enter", that command will be repeated at the current command prompt. Press enter again, and the command gets executed.

    Force IDLE to adapt itself to you: If you insist on making the arrow keys in the IDLE command prompt window work like those in every other command prompt, you can do this. Go to the "Options" menu, select "Configure IDLE", and then "Keys". Changing the key that is associated with the "previous command" and "next command" actions to be the up arrow, and down arrow, respectively.

    source

    0 讨论(0)
  • 2020-11-29 17:11

    Using arrow keys to go to the start of the command and hitting enter copies it as the current command.

    Then just hit enter to run it again.

    0 讨论(0)
  • 2020-11-29 17:12

    ALT + p works for me on Enthought Python in Windows.

    0 讨论(0)
  • 2020-11-29 17:12

    it is control + p in Mac os in python 3.4 IDEL

    0 讨论(0)
  • 2020-11-29 17:16

    Up arrow works for me too. And i don't think you need to install the Readline module for python builtin commandline. U should try Ipython to check. Or maybe it's the problem of your keybord map.

    0 讨论(0)
提交回复
热议问题