I've got a python script that uses mechanize to grab data from a web page. This is working fine but I've done a hack job of then using bash to filter for the text I'm looking for. I now need to do this in the main python script as I need to use the output value.
response = br.submit()
print response.read()
This prints out the response which I then manipulate with bash
| grep usedData | cut -d '"' -f2 | sed 's/\<GB used\>//g'`
How can I do this all in python?
The output from the bash script would be a number (eg 123.45)
Input:
<tr><th>Current Data Usage: </th><td>221.59GB</td></tr>
Output: 221.59