Correct way to create a shell like environment in python?

Posted by Wilduck on Stack Overflow See other posts from Stack Overflow or by Wilduck
Published on 2010-05-03T00:52:30Z Indexed on 2010/05/03 0:58 UTC
Read the original article Hit count: 293

Filed under:
|
|

I'm trying to create a shell like environment, where a user is presented with ">>>" and can type in any of a number of pre-defined commands. However, the only way I can think of implementing this is with a dictionary mapping commands->code and python's "exec".

Is there a more correct way of doing this?

© Stack Overflow or respective owner

Related posts about python

Related posts about shell