I've been learning to crawl by myself recently , Yes SyntaxError: invalid syntax, Kneel down for a solution
Source code
import requests
import re
r=requests.get(
url='https://movie.douban.com/top250'
headers={
'User-Agent':Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3947.100 Safari/537.36
}
)
print(r.status_code)
print(r.text)
The output is
headers={
^
SyntaxError: invalid syntax