How can I reach to source code of a web page with python ?
I use these code block but it doesn't work perfectly. If I open the html file(site.html) on a web browser, some characters disapper.

import urllib.request

req = urllib.request.Request('')
response = urllib.request.urlopen(req)
the_page =
a = open('site.html', 'w+')

This code block is solving the our problem:

from urllib.request import urlretrieve
url = ''
urlretrieve(url, 'site1.html')

You probably have to open the file in binary mode ("wb"). I do not think you have to convert the_page to anything before writing.

Otherwise use urlretrieve, as you already found out.