dimanche 19 novembre 2017

python while loop implementation [duplicate]

This question already has an answer here:

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

Aucun commentaire:

Enregistrer un commentaire