yasoob / practical-python-projects

99 stars 42 forks source link

Code Error: 2.7 #4

Closed smithers closed 3 years ago

smithers commented 4 years ago

Location within the Book

Hint: Page numbers change all the time. The best way to report an issue is by chapter and section numbers.

Description

If code-related, enter it within these backticks. Otherwise, delete this segment.


2 for info in zip(titles,prices, tags, total_platforms):
3 resp = {}
4 resp['title'] = info[0]
5 resp['price'] = info[1]
6 resp['tags'] = info[2]
7 resp['platforms'] = info[3]
8 output.append(resp)
'''

## Possible Solutions
Line 2 should use the argument total_tags in the zip method, not tags.

## Your full name so I can provide accurate credit within the book
Jeff Czarniak
yasoob commented 4 years ago

Thank you so much for reporting this issue @smithers! I will take a look into it and will close this issue and give you attribution once it is fixed.

dmalten commented 4 years ago

In the step by step code for this chapter the code looks like this:

tags = new_releases.xpath('.//div[@class="tab_item_top_tags"]')
total_tags = []
for tag in tags:
    total_tags.append(tag.text_content())
tags = [tag.split(", ") for tag in tags] 

In the last line i have to change tags to total_tags so that it works. tags = [tag.split(", ") for tag in total_tags]

But in your overview at the end of the chapter the first line doest exist like that, no total_tags list:

tags = []
for tag in new_releases.xpath('.//div[@class="tab_item_top_tags"]'):
    tags.append(tag.text_content())

tags = [tag.split(', ') for tag in tags]

I hope that helps.

yasoob commented 3 years ago

This issue has been fixed in the latest version and the update will be sent out later today. @smithers I have added your name to the acknowledgement section so make sure you check it out once you receive the update :) Have a wonderful day!