I want to import an text file to python script, and then do an if condition, something like this:
Let's say that I have this in example.txt file:
os: ubuntu
required: no
And I want to do this:
if os =="ubuntu" and if required== "no":
(exec terminal command);
elif os =="debian" & if required== "yes":
(exec another terminal command);
Ignore syntax errors, it was only for you to understand.
EDIT
Thanks to @zyad osseyran, I managed to get this.
f = open("example.txt", "r")
for x in f:
x = x.split(':')
atribute = x[0]
value = x[1]
How can I make this, turning into and dictionary? And, how to get the values from here, to make an IF Condition?