os.system() with imbeded quotes on centos

cevyne at gmail.com cevyne at gmail.com
Mon Apr 1 15:22:08 EDT 2013


I get the example os.system('ls -al')     no problem.

i'm trying to create a variable with my command built in it but needs to include quotes.
Portion of code is as follows:
someip = '192.168.01.01'

var1 = 'lynx -dump http://' + someip + '/cgi-bin/xxxx.log&.submit=+++Go%21+++  > junk' 

print  var1

os.system(var1)


If I print var1 it looks right .  If I use the os.system(var1) as above it seems to have a problem near the end of the string with msg 
sh: .submit=+++Go%21+++: command not found

clearly there is some escape sequence that I don't understand .

I tried combinations of single and double quotes and mixed around var1 in os.system(), but that generates command not found.  

I need it to look like how I enter it manually and works
lynx -dump 'http://192.168.01.01/cgi-bin/xxxx.log&.submit=+++Go%21+++  > junk' 

Probably obvious to many but i'm spinning my wheels.  many thanks for help .



More information about the Python-list mailing list