如何在python 3.10中实现类似bash历史记录的上/下箭头键功能
我正在制作完全用python 3.10写的外壳,目的是自学python,然后弄乱。我目前正在尝试实施能够按下上/向下箭头键,以便像Bash一样访问先前输入的命令,但我绝对不知道该如何实施,我还没有找到任何尝试过的人。如果可能的话,有人对此有任何想法吗?具体来说,我不确定如何更改终端中的输入线(替换 ^[[a and ^[[b)。
I'm working on a shell written entirely in python 3.10 for the purposes of teaching myself python and just messing around. I'm currently trying to implement being able to hit the up/down arrow keys to access previously entered commands like bash does but I have absolutely no idea how to implement this and I haven't found anybody else who's tried. Does anybody have any ideas for this if it is possible? Specifically I am unsure how to change the input line in the terminal (replacing the ^[[A and ^[[B).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论