In article <[EMAIL PROTECTED]>,
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote:
>Cameron Laird wrote:
>
>> def f1(Match):
>> return
>
>Something missing here?
Ugh; yes, sorry:
def shell_escape(Arg) :
"""returns Arg suitably escaped for use as a command-line argument
to Bash."""
pattern = r"[\<\>\"\'\|\&\$\#\;\(\)\[\]\{\}\`\!\~\ \\]"
def f1(Match):
return "\\" + Match.group(0)
return re.sub(pattern, f1, Arg)
# Need to catch anything that might be meaningful to shell
#end shell_escape
--
http://mail.python.org/mailman/listinfo/python-list