Skip to content Skip to sidebar Skip to footer

I Want To Print A Proper Table Out Of Data Scraped Using Scrapy

so i have written all the code to scrape table from [http://www.rarityguide.com/cbgames_view.php?FirstRecord=21][1] but i am getting output like # the output that i get {'EXG': ([

Solution 1:

You need to iterate through each row in table and process row data separately. As all row have the same length you can use list unpacking to write data into dict item:

def parse(self, response):
    table = response.css(
        "form table")

    for row in table.css("tr"):
        i = {}
        _, i["title"], i["company"], i["year"], _, i["mnm"], i["EXG"], i["G"] = row.css("td::text").extract()
        i["rarity"] = row.css("td img::alt").extract_first("")
        yield i

Post a Comment for "I Want To Print A Proper Table Out Of Data Scraped Using Scrapy"