Created
September 6, 2018 15:03
-
-
Save Bouni/1abf90dd16fed9e26d3a15b316b4a6ea to your computer and use it in GitHub Desktop.
swiss_hydrological_data regex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location = re.findall(r"<option selected=\"selected\" value=\"\d+\">(.*)\s\(\s\d+\s\)</option>", response.text) | |
location = [s.strip() for s in location[0].split("-")] | |
captions = re.findall(r"<th class=\"text-center\" scope=\"col\">(\w+)<br>", response.text) | |
data = re.findall(r"<td class=\"text-center\">([\d\.]+)</td>", response.text) | |
['Rhein', 'Rekingen'] | |
['Abfluss', 'Wasserstand', 'Temperatur'] | |
['261', '322.28', '21.1', '250', '322.25', '21.1', '264', '322.29', '21.2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment