I would like to use python for things I\'ve been doing using bash. Is it possible to use the -c switch for long programs, e.g. a for loop with two statements? This would let
If you are running from a bash script, just use quotes:
#!/bin/sh
python -c 'import os
for i in range(3):
for j in range(3):
print i*j
'
echo "done"
Otherwise, if using the cmd line, use ;
semicolons to seperate statements, or use single quotes again to wrap around to the next line:
python -c 'import os
> for i in range(3):
> for j in range(3):
> print i*j
> '