Найти - Пользователи
Полная версия: Создание парсера
Начало » Python для новичков » Создание парсера
1 2 3
Kasta_neda
for tag in page.findAll('li'):
    a=tag.find('a')
    for i in a.contents:
        print i[0:]
hubble
Ситуация, похожая, как в топике #10 на странице 2. Но немного по другому.
В Sublime Text 3 результат не выдает (а ТОЛЬКО текст, который в самом низу топика).
А вот в IDLE и PyCharm код ниже работает (с тем же текстом, что внизу, но И С РЕЗУЛЬТАТОМ).

import requests
from bs4 import BeautifulSoup
r = requests.get("http://fs.to/video/films/group/film_genre/")
responce = r.content
page = BeautifulSoup(responce)
for tag in page.findAll('li'):
    a=tag.find('a')
    for i in a.contents:
        print(i[0:])

Во всех трех редакторах выдает такой текст:

C:\Python34\lib\site-packages\bs4\__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system (“lxml”). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

To get rid of this warning, change this:

BeautifulSoup()

to this:

BeautifulSoup(, “lxml”)

markup_type=markup_type))

На это обращать внимание? Это другой вопрос.

P.S. Работаю под Windows 7
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB