I have want to write and store a simple if else output in a value. I have filenames like this.
US_Sales_2019090200022300023223155
UK_Sales_2019090200022300023223155
Sales_2019090210022300023223155
Sales_2019090210022300023223155
If Country is US or UK , I want to store the output value in Country as US or UK (Country1==file[:2]). If not I want to store the output value in Country as like 201909021 (Country2==file[5:13])
Please help me.
Country==[]
Country1==file[:2]
Country2==file[5:13]
if Country1=='US'|Country1=='UK':
Country1==Country
else:
Country2==Country
=, not==(which is correct to compare inside the if, but not to assign values to variables). You also reversed the assignments inside the if statement, should beCountry=Country1andCountry=Country2.