os.system() with imbeded quotes on centos

Chris Angelico rosuav at gmail.com
Mon Apr 1 15:33:12 EDT 2013


On Tue, Apr 2, 2013 at 6:22 AM,  <cevyne at gmail.com> wrote:
> var1 = 'lynx -dump http://' + someip + '/cgi-bin/xxxx.log&.submit=+++Go%21+++  > junk'
> lynx -dump 'http://192.168.01.01/cgi-bin/xxxx.log&.submit=+++Go%21+++  > junk'


The problem is the &, which splits the command. Note how your manual
execution puts single quotes around just the URL; in the other
version, you're not doing that. (Though I'm not entirely sure why your
> junk is inside the quotes - is that an error?) Try this:

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

ChrisA



More information about the Python-list mailing list