shlex

What is the difference between shlex.split() and re.split()?

What is the difference between shlex.split() and re.split()? Question: So I used shlex.split() recently to split a command as argument to subprocess.Popen() function. I recalled that long back I also used re.split() function to split a string with a specific delimiter specified. Can someone point out what is the essential difference in between them? In …

Total answers: 2

What's the reverse of shlex.split?

What's the reverse of shlex.split? Question: How can I reverse the results of a shlex.split? That is, how can I obtain a quoted string that would “resemble that of a Unix shell”, given a list of strings I wish quoted? Update0 I’ve located a Python bug, and made corresponding feature requests here. Asked By: Matt …

Total answers: 6