[Tutor] os.system() with imbeded quotes

cevyn e cevyne at gmail.com
Mon Apr 1 21:08:00 CEST 2013


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

i'm trying to create a variable with my command built 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, 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 .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130401/513752ee/attachment.html>


More information about the Tutor mailing list