how to pass scripts to python -c

eltronic at juno.com eltronic at juno.com
Sun Feb 8 03:37:36 EST 2004


On 7 Feb 2004 22:21:42 -0800 danl_kramer at yahoo.com (Daniel Kramer)
writes:
> what are the formatting rules to passing python commands to the 
> python
> command line?  I've tried the following, which works:
> 
> echo hello | python  -c "import sys; print sys.stdin.read()[:4]"
> 
> I'm actually trying to shell out of another scripting lang that's 
> not
> very good at string parsing to have python do some work.. the only
> problem is this other lang doesn't like the ";" in my python command
> string and fails.  Is there another notation I can use on a single
> line to tell python that there is a line break?
import os
os.system('python  -c "import sys\x3b print sys.path"')


e
please forward all spam  to "me"<u%63e at f%74c.go%76>

________________________________________________________________
The best thing to hit the Internet in years - Juno SpeedBand!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!




More information about the Python-list mailing list