I want to sort some kind of functions by Python and XML, but I’m really confused about it.
I’ll give you an example,
There are 3 input options that contains in a config.xml file.
<inputs>
<input1 value='1- Sending Email' />
<input2 value='2- Extracting a Tar File' />
<input3 value='3- Rebooting Server' />
</inputs>
—
So, I have already pythoned each function in a folder named “funcs” and I have no problems with them.
All I want is;
1- Listing the inputs and ask for which one to choose.
2- And I need to do it by array. Because I only want to update the XML file in the future, so I’ll never touch the main file that lets python to do every functions.
Any help will make me grateful, thank you.
This involves a bit of mindreading, but I think I know what you’re looking for… I built a file called
inputs.xmlthat contains the xml you referenced above, then I read it and stored the inputs in a python dictionary calledinputsThe results…
Now suppose you take input from a user and store it as a string in a python variable called
input… if you want to access what choice the user selected, useinputs["input"+input]…