Quote POSIX shell special characters in Python output
Posted
by ??O?????
on Stack Overflow
See other posts from Stack Overflow
or by ??O?????
Published on 2010-04-22T17:01:16Z
Indexed on
2010/04/22
17:03 UTC
Read the original article
Hit count: 339
There are times that I automagically create small shell scripts from Python, and I want to make sure that the filename arguments do not contain non-escaped special characters. I've rolled my own solution, that I will provide as an answer, but I am almost certain I've seen such a function lost somewhere in the standard library. By “lost” I mean I didn't find it in an obvious module like shlex
, cmd
or subprocess
.
Do you know of such a function in the stdlib?
© Stack Overflow or respective owner