
2·
2 years agoe.g. shell=True allows you to pass the command as a single string
Don’t do this. As the article says its much better to split the string using shlex
and avoid the risk of shell injection vulnerabilities.
e.g. shell=True allows you to pass the command as a single string
Don’t do this. As the article says its much better to split the string using shlex
and avoid the risk of shell injection vulnerabilities.
#\s+
is:#
: a literal#
\s
: any whitespace character (space, tab etc)+
: the previous thing (here the whitespace), one or more timesIn words: “a hash followed by at least one whitespace character”
#[^\s].
is:#
: a literal#
[^\s]
: a negated character class. This matches anything other than the set of characters after the^
.\s
has the same meaning as before, any whitespace character.
: matches any single characterIn words: “a hash followed by any character other than a whitespace character, then any character”.
https://regex101.com/ is really good for explaining regex