Skip to content

Commit 2926f69

Browse files
committed
Chapter 11 finished
1 parent f998b01 commit 2926f69

16 files changed

+9928
-0
lines changed

11-web/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# web moduels
2+
* webbrowser: 是Python自带的,打开浏览器获取指定页面。
3+
* requests: 从因特网上下载文件和网页
4+
* Beautiful Soup: 解析HTML,即网页编写的格式
5+
* selenium: 启动并控制一个Web浏览器。selenium能够填写表单,并模拟鼠标在这个浏览器中点击。
6+
7+
# webbrowser
8+
<pre>
9+
import webbrowser
10+
webbrowser.open(https://cn.bing.com/ditu/Default.aspx?q=' + address)
11+
</pre>
12+
13+
# requests
14+
`pip install requests`
15+
<pre>
16+
import requests
17+
18+
res = requests.get('http://www.gutenberg.org/cache/epub/1112/pg1112.txt')
19+
try:
20+
res.raise_for_status()
21+
print(res.text[:250])
22+
except Exception as exc:
23+
print('There was a problem: %s' % (exc))
24+
</pre>
25+
26+
# BeautifulSoup
27+
`pip install beautifulsoup4`
28+
<pre>
29+
import bs4
30+
</pre>
31+
32+
# selenium
33+
install geckodriver
34+
https://github.com/mozilla/geckodriver

0 commit comments

Comments
 (0)