0

I have this piece of code below. What I want is to repeat the raw_input and repeat the if statement if the user prompt the wrong option

firewall = raw_input('Please, select IE13PVPNFW01 or IE23PVPNFW01 > ')
if firewall == 'IE13PVPNFW01':
  device = {'IE13PVPNFW01': {'ip': '10.248.40.93'}}
elif firewall == 'IE23PVPNFW01':
  device = {'IE23PVPNFW01': {'ip': '10.42.19.58'}}
else:
  print "Wrong device, options available IE13PVPNFW01 or IE23PVPNFW01"

Thanks

6
  • 2
    add a while loop, and break when ok... Commented Nov 19, 2017 at 19:51
  • I already new that. If I am asking is because I need help to implement that. Any example? Commented Nov 19, 2017 at 20:51
  • follow the link on the question I linked to. Of course you'll have to adapt to your needs. Basically I'd do a while True: and break when I define device Commented Nov 19, 2017 at 20:59
  • If I do that and device I put a different device name the loop run to infinite. Instead to redirect to other links (that like in this case are different on my question) would be easier and better if you give me an example using my code. In this way I can have a real understanding to how implement it Commented Nov 19, 2017 at 21:05
  • Never mind. I have managed to fix by my own Commented Nov 19, 2017 at 21:13

0