Python HTML source code
<p>I would like to write a script that picks a special point from the source code and returns it. (print it)</p>

<pre><code>import urllib.request                           

Webseite = "http://myip.is/"                    
html_code = urllib.request.urlopen(Webseite)

print(html_code.read().decode('ISO-8859-1'))
</code></pre>

<p>This is my current code.
I would like to print only the IP address that the website gives.
The input of this I will print in python (title="copy ip address").</p>

<pre><code>import requests
from bs4 import BeautifulSoup

s = requests.Session()
r = s.get('http://myip.is/')

soup = BeautifulSoup(r.text, "html5lib")
myIP = mySoup.find('a', {'title': 'copy ip address'}).text
print(myIP)
</code></pre>

<p>This uses the requests library (which you should always use for HTTP requests) to pull the page, feeds the content to BeautifulSoup, a very nice HTML parser, and asks BeautifulSoup to find a single <code>&lt;a&gt;</code> tag, with the atrtibuet <code>title</code> set to 'copy ip address', and then save the text component of that tag as <code>myIP</code>. </p>

python python-3.x