I’m trying to read data from a website and have that data stored into a variable.
Example:
http://www.example.com/example-info.php ->
Name: Bob
Address: 1234 Street
Telephone: 000-000-0000
Email: Bobs-email@nothing.com
What I would like to do is get the value from the label “Name” which is Bob and store it into a variable such as “Username”. or “Telephone” and store the value into a variable named “Phone”. Can someone point me in the right direction. Perhaps I need to use Mechanize?
Are you trying to screen scrape the website? If so, using requests or BeautifulSoup are good things to look at.
x.contentin the above scenario will hold the data/html from the page you send the request to. Then, you could use BeautifulSoup or regex to extract out the particular information you need.