I'm new to Python and need some help. The web hasn't been very helpful. Simply put, I have a web response that looks like this:
<html>
<field>123</field>
<field>456</field>
</html>
What I'm trying to do is take all of the contents from the field elements into an array that I can index. The end result would look like this:
myArray[0] = 123
myArray[1] = 456
and so on...
What I'm going to end up doing with this is running a random number generator to randomly pick one of the elements in this array and retrieve its value.
Is this possible? I can't seem to find a straight answer on the web, so I feel like I might be asking for the wrong thing.
I would use XPath Xpath python to parse the values and just insert them into a list, first declare and empty list my_list=[]
and then just append the values my_list.append(parsed_value)
.