1

I am currently developing a console application in python.It takes commands from the terminal in the format <my-python-module.py> <command> <other-args> However i want to drop into REPL and when i write

my-program

It should do like the fololowing

my-program> command 1
my-program> command 2
my-program> exit
good-bye!

How do i do that?

1

1 Answer 1

2

The standard library has cmd which gives you "support for line-oriented command interpreters":

The Cmd class provides a simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface

There's also prompt-toolkit:

prompt_toolkit is a library for building powerful interactive command lines and terminal applications in Python.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.