0
 if 'env' == 'dev':
    url = 'someabc'
 elif 'env' == 'prd':
    url = 'somexyz'
 elif 'env' == 'int':
    url = 'somedef'

Can we get the multiple if elif condition in better way, or this is the only way we need to write?

saurau01
  • 29
  • 6

1 Answers1

1

You could create a dictionary with the different 'env' values as the keys and the url's as the corresponding values. Then just select the key of the dictionary. Don't know how feasible it will be for your case though since I don't know what how you are handling your variables in your code.

Anurag Reddy
  • 1,159
  • 11
  • 19