You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CODE
print "review_number:",review_number
if review_number !=None and review_number != "" :
if int(review_number)>0:
count=0
while count<=(int(review_number)/10):
url_review=unicodedata.normalize('NFKD', url_info).encode('ascii','ignore')+"/reviews/"+unicodedata.normalize('NFKD',unicode(count)).encode('ascii','ignore')
print url_review
page = myopener.open(url_review)
soup = BeautifulSoup(page,"html")
reviwes=soup.findAll(class_="storefront__review divider bottom padding-listItem")
for review in reviwes:
name_reviwer=review.find("span", {"itemprop":"name"}).get_text()
rating_reviwer=review.find(class_="m-review").find("span", class_="squeeze").get("star-rating")
review_text=review.find("p",{"itemprop":"reviewBody"}).get_text().replace("\n","")
# write data in All Reviews.csv file
file_review.writerow([name,name_reviwer, review_text,rating_reviwer])
count =count+1
Below is the error I am getting
Traceback (most recent call last):
File "data_mining.py", line 150, in
url_review=unicodedata.normalize('NFKD', url_info).encode('ascii','ignore')+"/reviews/"+unicodedata.normalize('NFKD',unicode(count)).encode('ascii','ignore')
TypeError: must be unicode, not str
The text was updated successfully, but these errors were encountered:
Dear all,
I am having a problem with a phython code below
CODE
print "review_number:",review_number
if review_number !=None and review_number != "" :
if int(review_number)>0:
count=0
while count<=(int(review_number)/10):
url_review=unicodedata.normalize('NFKD', url_info).encode('ascii','ignore')+"/reviews/"+unicodedata.normalize('NFKD',unicode(count)).encode('ascii','ignore')
print url_review
page = myopener.open(url_review)
soup = BeautifulSoup(page,"html")
reviwes=soup.findAll(class_="storefront__review divider bottom padding-listItem")
for review in reviwes:
name_reviwer=review.find("span", {"itemprop":"name"}).get_text()
rating_reviwer=review.find(class_="m-review").find("span", class_="squeeze").get("star-rating")
review_text=review.find("p",{"itemprop":"reviewBody"}).get_text().replace("\n","")
# write data in All Reviews.csv file
file_review.writerow([name,name_reviwer, review_text,rating_reviwer])
count =count+1
Below is the error I am getting
Traceback (most recent call last):
File "data_mining.py", line 150, in
url_review=unicodedata.normalize('NFKD', url_info).encode('ascii','ignore')+"/reviews/"+unicodedata.normalize('NFKD',unicode(count)).encode('ascii','ignore')
TypeError: must be unicode, not str
The text was updated successfully, but these errors were encountered: