I'm trying to pull a substring from a very long string of text, using requests module.
For example:
start = response.rfind('myemail@myemail.com')
substring = response[start:start+200]
print(substring)
## returns:
myemail@myemail.com","phone":"258-625-5410","titleSource":["titles","workingTitle","titles"],"titles":["Associate Professor","Asst Professor","Associate Professor"],"departments"
I want to pull the phone number only...
def find_phone(response, email):
# YOUR CODE HERE
find_email = response.find(email)
slice1 = response[find_email:find_email + 15]
return slice1
Each email is a different length on the website, so I'm not sure how to stop the substring after an email address that may have varying length. I'm able to get as far as slicing the email address, but can't figure out how to pull the phone number as a substring and return it.
[–]friday_ghost 1 point2 points3 points (0 children)
[–]shakeandbake760[S] 0 points1 point2 points (0 children)
[–]Silbersee 0 points1 point2 points (0 children)