I am writing a simple Python script with if-else condition in a for a loop by reading inputs line by line from a text file. Below is my script.
I should get the expected output. Please help!
My env.txt contains:
DEV01
DEV02
UAT01
UAT02
Here is the code:
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