Escaping strings to be used in shell commands?

Donn Cave donn at oz.net
Thu Apr 12 22:41:48 EDT 2001


Quoth Gabriel Ambuehl <gabriel_ambuehl-py at buz.ch>:

| I wonder what is the easiest way to escape user submitted strings so I
| can
| safely use them in os.system() calls. Limiting the allowed chars isn't
| feasible since I want them to use as safe passwords as possible and
| those generally DO consist of special chars. Any good ideas how I
| could solve this?

You can avoid this problem with os.spawnv, instead of os.system.

	Donn Cave, donn at oz.net



More information about the Python-list mailing list