I need to read the exit of a command (then I have to wait for it in sync way):
import subprocess
subprocess.call('ls ~', shell=True)
My problem is a path like this:
~/testing/;xterm;/blabla
How could I sanitize that string from user (allowing special characters from his language)?
import subprocess
subprocess.call('ls ~/testing/;xterm;/blabla', shell=True) # This will launch xterm
I found escapeshellcmd in PHP, but I didn't find anything in Python.
PS: It's not a duplicate of this:
- Because it's the complete path, not the filename.
- And I read the
os.path
and I didn't find a solution.
Thanks in advance!
=======