How do you use " " whe sending a command

Ulrich Petri ulope at gmx.de
Tue Sep 30 20:27:26 EDT 2003


> "Fernando Armenta" <farmenta at pillardata.com> schrieb im Newsbeitrag
news:mailman.1064965743.15057.python-list at python.org...
> Hello,
>
> I am trying to pass the following command
>
> ssh IP_address "ssh IP_address ls"
>
> How you do that in Python?
> /" ?
> "/ ?

a = " ' "
b = ' " '
c = """ " ' ''' """
d = ''' " ' """ ''''

> p = os.popen('ssh.exp ' + MGMT_IP + ' ' + /" ssh + PMI_IP_NODE1 + ' ' +
/bin/tdslog -C "/')
>
But a imho better way would be:

vars = {'mgmt_ip': '10.0.0.1', 'ip':'10.0.0.2', 'cmd':'/bin/ls'}
command = 'ssh.exp %(mgmt_ip)s "ssh %(ip)s %(cmd)s"' % vars
p = os.popen

HTH

Ciao Ulrich






More information about the Python-list mailing list