title: How can i loop ip address for two routers
body: <p>I am beginner to python and i made telnet access to two routers R1and R2 through( <code>for x in range  (1,3) :</code>) loop and i want to include in the same loop, loop back interfaces for each router example:
  R1 only have  interface  loopback 1 1.1.1.1 255.255.255.255
  R2 only have interface  loopback 2  2.2.2 255.255.255.255
  I successfully created the loop back interfaces but am not able to assign the ip address for each one .</p>
  
  <pre><code>import getpass
  
  import sys
  
  import telnetlib
  
  
  
  user = raw_input("Enter your Telnet Username: ")
  
  password = getpass.getpass()
  
  
  
  for n in range (1,3):
  
      HOST = "10.1.1." + str(n)
  
      tn = telnetlib.Telnet(HOST)
  
      tn.read_until("Username: ")
  
      tn.write(user + "\n")
  
      if password:
  
          tn.read_until("Password: ")
  
          tn.write(password + "\n")
  
      tn.write("config t\n")
  
      tn.write("int l " + str(n) +"\n")
  
      tn.write("ip add  str(n) . str(n) . str(n)  . str(n)    255.255.255.255 \n")
  
      tn.write("router eigrp 1\n")
  
      tn.write("net 0.0.0.0\n")
  
      tn.write("end\n")
  
      tn.write("sh ip int br\n")
  
      tn.write("exit\n")
  
  
  
      print tn.read_all()
  </code></pre>
  
  <p>Thanks</p>