line to argv transformation

A

Antoon Pardon

I am looking for an interface that takes a string as argument. The
string is to be treated as if it is a command line and transformed into
an argv list.

"ls file" -> ['ls', 'file']
"ls *.py" -> ['ls', 'file1.py', 'file2.py', ...]
"ls '*.py'" -> ['ls', '*.py']

Does something like this already exist? I looked around but seem to find
only things only partially do things like this, like shlex.split.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top