Reputation: 1671
I want to ssh to another node on my network as part of a larger python script, I am using pexpect which works when I do something like this:
session=spawn('ssh [email protected]')
I want to replace the address with a variable so I can cycle through addresses in a list however when I try:
address = "172.16.210.253"
session=spawn('ssh root@'address)
It doesn't work as using address in this way is invalid syntax. What is the correct syntax for this?
Upvotes: 2
Views: 2869
Reputation: 43245
session=spawn('ssh root@' + address)
to concatenate the strings
Upvotes: 5