Objective
- I'm looking to use the regular expression
\d+
to extract just the digits from the string,answer_40194
.
Problem
- I'm targeting a form element with Selenium and I'm printing the formID to the Terminal, but after the line
re.findall('\d+', formID)
I expectformID
to be just the numbers40194
, but instead I'm getting the entire stringanswer_40194
.
script.py
import selenium
import re
form = browser.find_element_by_tag_name('form')
formID = form.get_attribute('id')
re.findall('\d+', formID)
print formIDNumber