Mechanize is kind of old and I don't think it's maintained anymore, it's still good if you're on Python 2.
For scraping you can use
requests and
bs4as mentioned above, for most sites, for something with heavy JavaScript you might have to go with Scrapy/ScrapyJS, good luck.
Code
PS C:\WINDOWS\system32> python -m pip install BeautifulSoup4, requests, mechanize --upgrade --force
Collecting BeautifulSoup4
Using cached beautifulsoup4-4.4.1-py2-none-any.whl
Collecting requests
Using cached requests-2.9.1-py2.py3-none-any.whl
Collecting mechanize
Using cached mechanize-0.2.5.tar.gz
Installing collected packages: BeautifulSoup4, requests, mechanize
Found existing installation: beautifulsoup4 4.4.1
Uninstalling beautifulsoup4-4.4.1:
Successfully uninstalled beautifulsoup4-4.4.1
Found existing installation: requests 2.9.1
Uninstalling requests-2.9.1:
Successfully uninstalled requests-2.9.1
Found existing installation: mechanize 0.2.5
Uninstalling mechanize-0.2.5:
Successfully uninstalled mechanize-0.2.5
Running setup.py install for mechanize ... done
Successfully installed BeautifulSoup4-4.4.1 mechanize-0.2.5 requests-2.9.1
PS C:\WINDOWS\system32> python -c "import requests, mechanize, bs4 #testing their installation"
Good intro video into scraping with Python
Code
#!/usr/bin/env python
from bs4 import BeautifulSoup
import requests
import mechanize
url = "http://d2jsp.org"
page = requests.get(url).content
soup = BeautifulSoup(page.content, 'html.parser')
soup.title.text
mech = mechanize.Browser()
mech.open(url)
mech.title()