I am writing a simple python script with if-else condition in a for loop by reading inputs line by line from a text file. Below is my script. I should get expected output. Please help! My env.txt contains: DEV01 DEV02 UAT01 UAT02
with open("env.txt") as envnames:
for eachenv in envnames:
if eachenv=="DEV01" or "DEV02":
eachenv="dev"
print (eachenv)
elif eachenv=="UAT01" or "UAT02":
eachenv="uat"
print(eachenv)
else :
print('')
Expected: dev dev uat uat
actual: dev dev dev dev
Aucun commentaire:
Enregistrer un commentaire