convert set to a list type in python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: convert set to a list type in python (/thread-32369.html) |
convert set to a list type in python - firaki12345 - Feb-05-2021 hi everyone so i am scraping amazon website, but having trouble to turn every absolute link into a list type? what am i doing wrong.. I am only getting one link as there are 16 links on one page. from requests_html import HTMLSession import time import pandas as pd s = HTMLSession() r = s.get("https://www.amazon.in/s?k=oneplus&page=1") r.html.render(sleep=1) Everything = r.html.find("div.s-include-content-margin.s-border-bottom.s-latency-cf-section") for e in Everything: links = e.find("a.a-link-normal.a-text-normal")[0].absolute_links t = list(links) print("\n",t)output RE: convert set to a list type in python - Larz60+ - Feb-05-2021 Quote:convert set to a list type in python >>> hh = {2, 4, 6, 8, 10} >>> type(hh) <class 'set'> >>> hh = list(hh) >>> type(hh) <class 'list'> RE: convert set to a list type in python - buran - Feb-05-2021 cross-posted https://stackoverflow.com/questions/66065639/remove-all-from-list-type |