开发者

Custom (interactive) shell with Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_如何学C

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

I'm currently trying to make some small shell-like utility for a custom script I wrote, so I can easily work with it (it's rather simple, so an interactive shell would be perfect).

Do you have any resources for me on how to create a shell in Python? I spent googling for a while, but all I could find was information about IDLE and similar Python interpreters. But I would rather want to know how to write a completely custom and command line based shell.

My approach would be hooking the stdin/out for commands, but given that the Python library offers so many great utilities, I want to make sure there if there is no better way.


The cmd module in the standard library could be a start -- if you have any trouble using it, please post more specific questions (ideally with some toy example showing what you're trying to achieve and what you're getting instead!).


You might have a look at pyparsing. It is definitely only about lexing and parsing, but that's definitely the hardest part of the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜