Antoon Pardon wrote:
> 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.
You might combine shlex and glob:
parts = shlex.split(s)
expanded = 
for part in parts:
matches = glob.glob(part)