The import requests
The from bs4 import BeautifulSoup
Num=0
Url="https://movie.douban.com/subject/27140017/comments? Status=P '
The req=requests. Get (url)
Soup=BeautifulSoup (the req. Text, 'LXML')
XML=soup. Find_all (' p 'class_=' ')
For I in range (len (XML) :
[I] MSG=XML string
If not MSG is None:
Num +=1
Print (' first ', num, 'a', MSG)
D: \ pythonw. Exe C:/Users/DELL/u1/unnatural. Py
The process has finished, exit code 0