How to Crawl Website Content by Python
<p>I'm studying Python. I want to get content on one URL  . Get all text in one title  on the website and save it to file .txt. Can you show me some code example?   </p>

<p>By <code>Get all text in one title on the website</code> I assume you mean get the title of the page?</p>

<p>Firstly, you'll need BeautifulSoup</p>

<p>If you have <code>pip</code>, use</p>

<p><code>pip install beautifulsoup4</code></p>

<p>Now onto the code:</p>

<pre><code>from bs4 import BeautifulSoup
from requests import get
r = get(url).text
soup = BeautifulSoup(r, 'html.parser')
title = soup.title.string #I save the title to a variable rather then jus
with open('url.txt', 'w') as f:
    f.write(title)
</code></pre>

<p>Now, where ever you have the script saved, will have a file called <code>url.txt</code> containing the URL.</p>

python python-3.x web website web-crawler