morvanzhou / easy-scraping-tutorial Goto Github PK
View Code? Open in Web Editor NEWSimple but useful Python web scraping tutorial code.
Home Page: https://morvanzhou.github.io/tutorials/data-manipulation/scraping/
License: MIT License
Simple but useful Python web scraping tutorial code.
Home Page: https://morvanzhou.github.io/tutorials/data-manipulation/scraping/
License: MIT License
In [3]:
jan = soup.find('ul', {"class": 'jan'})
d_jan = jan.find_all('li') # use jan as a parent --> this cannot work, jan is a list already.
for d in d_jan:
print(d.get_text())
一月一号
一月二号
一月三号
In the code of requests.post().
I don't why you code can only print('Hello there, !') even change Chinese into English.
data = {'firstname': '莫烦', 'lastname': '周'}
r = requests.post('http://pythonscraping.com/files/processing.php', data=data)
print(r.text)
# Hello there, 莫烦 周!
Best Wish!
Distributed Crawling...
Distributed Parsing...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\PYTHON\lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "D:\sublime\mofan爬虫教程\4-1-distributed-scraping.py", line 18, in parse
page_urls = set([urljoin(base_url, url['href']) for url in urls]) # remove duplication
File "D:\sublime\mofan爬虫教程\4-1-distributed-scraping.py", line 18, in
page_urls = set([urljoin(base_url, url['href']) for url in urls]) # remove duplication
NameError: name 'base_url' is not defined
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "4-1-distributed-scraping.py", line 49, in
results = [j.get() for j in parse_jobs] # parse html
File "4-1-distributed-scraping.py", line 49, in
results = [j.get() for j in parse_jobs] # parse html
File "C:\PYTHON\lib\multiprocessing\pool.py", line 771, in get
raise self._value
NameError: name 'base_url' is not defined
Repl Closed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.