import re
import requests
i = 0 # 控制页数的遍历
url = "https://movie.douban.com/top250"
UA = {"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"}
douban = [] #储存数据
##预订正则表达式
obj = re.compile(r'
.*?(?P.*?).*?'
r' \[(?P.*?)\].*?'
r'.*?导演: (?P[\u4e00-\u9fa5]+).*? .*?'
r'
.*?(?P