[
'How do I merge two dictionaries in a single expression in Python (taking union of dictionaries)?',
'How to call an external command?',
'What are metaclasses in Python?',
'Does Python have a ternary conditional operator?',
'How do you remove duplicates from a list whilst preserving order?',
'Convert bytes to a string',
'How to get line count of a large file cheaply in Python?',
"Does Python have a string 'contains' substring method?",
'Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?'
]
抓取相似结果6 ~8 h$ b9 ^5 m. j4 \! c
当你还想获取stackoverflow上其他页面中所有相关的文章标题,则可以直接通过get_result_similar方法获取:3 X( r% p6 l" e6 O6 y7 D0 m: Y1 b
两个页面的抓取结果为:4 W0 s Q0 {0 b' \) Y
0 i3 `0 o' U( c' H4 i* z
抓取确切结果 - z" E- r( C7 w7 V" i 当你只想抓取某个确切的结果,可以使用get_result_exact方法,即从wanted_list中以完全相同的顺序检索数据: . }" R" ]7 k9 I- h1 I' p. S' ^
比如抓取页面中排第2的相关文章标题,执行结果:2 ]6 [( r5 g8 a u
4 [' t+ Q. `! C( n( x
自定义请求模块参数 " b. n: ~5 G+ d: y; H 你还可以传递任何自定义请求模块参数。例如,你可能想使用代理或自定义头: 8 i9 O, f- d3 D$ g- }4 u