-1

I want to put a variable in script that i made

let's say

host = 192.168.1.1

and my comment in the script is :

tn.write("cpconf tohost=192.168.200.22:XXX \n")

my request : want that instead XXX the variable it is will be host

how can do it ? use Python2.7.

glglgl
  • 89,107
  • 13
  • 149
  • 217
kobilevi
  • 1
  • 3
  • 2
    `tn.write("cpconf tohost=192.168.200.22:{0} \n".format(host))` – Abdul Niyas P M Jan 24 '21 at 08:20
  • As a beginner, you should not be investing time in learning Python 2. Those of us who still write it do it because we have to support legacy code. Please consider installing Python 3.9 and learning to write in that instead. – BoarGules Mar 25 '21 at 09:46

1 Answers1

0
tn.write("cpconf tohost=192.168.200.22:{0} \n".format(host))

Working! thanks

glglgl
  • 89,107
  • 13
  • 149
  • 217
kobilevi
  • 1
  • 3