帮我写一个python爬虫代码
时间: 2023-05-11 11:03:57 浏览: 119
当然可以,以下是一个简单的Python爬虫代码:
```python
import requests
from bs4 import BeautifulSoup
url = 'https://www.example.com'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
# 打印网页标题
print(soup.title.string)
# 打印所有链接
for link in soup.find_all('a'):
print(link.get('href'))
```
希望这可以帮到你!
阅读全文