title: Trying to use BeautifulSoup to scrape yelp ratings and export to csv, the csv though ONLY has the review comments and not rating or ID
body: <p>I'm trying to scrape 100 reviews/ratings on a Yelp restaurant for an assignment using BeautifulSoup. I'm specifically looking for:
  Review Comment
  Review ID
  Review Rating</p>
  <p>I'm pretty new to Python and I feel like I've missed something extremely obvious</p>
  <p>Here's what I've got so far:</p>
  <pre><code>from bs4 import BeautifulSoup
  import urllib.request
  </code></pre>
  <p><code>url = 'https://www.yelp.com/biz/ichiran-times-square-new-york-4?osq=Ichiban+Ramen' ourUrl = urllib.request.urlopen(url)</code></p>
  <p><code>soup = BeautifulSoup(ourUrl,'html.parser') type(soup) print(soup.prettify())</code></p>
  <p><code>for i in soup.find_all('div', {'class':&quot; arrange-unit__373c0__3XPkE arrange-unit-fill__373c0__38Zde border-color--default__373c0__r305k&quot;}): ID.append(i.find(&quot;div&quot;).get(&quot;aria-label&quot;))</code></p>
  <p><code>soup.find('p', {'class':&quot;comment__373c0__Nsutg css-n6i4z7&quot;})</code></p>
  <p><code>i = soup.find('p', {'class':&quot;comment__373c0__Nsutg css-n6i4z7&quot;}) i.text</code></p>
  <pre><code>review=[]
  rating = []
  ID = []
  
  for x in range(0,10):
  
  url = &quot;https://www.yelp.com/biz/ichiran-times-square-new-york-4?osq=Ichiban+Ramen=&quot;+str(10*x)
  
  ourUrl = urllib.request.urlopen(url)
  
  soup = BeautifulSoup(ourUrl,'html.parser')
  
  #for i in soup,
  
  
  for i in soup.find_all('div', {'class':&quot; i-stars__373c0___sZu0 i-stars--regular-5__373c0__20dKs border-color--default__373c0__1yxBb overflow--hidden__373c0__1TJqF&quot;}):
      per_rating = i.text
      rating.append(per_rating)
  
  for i in soup.find_all('span', {'class':&quot; arrange-unit__373c0__3XPkE arrange-unit-fill__373c0__38Zde border-color--default__373c0__r305k&quot;}):
      ID.append(i.find(&quot;div&quot;).get(&quot;aria-label&quot;))
  
  for i in soup.find_all('p', {'class':&quot;comment__373c0__Nsutg css-n6i4z7&quot;}):
      per_review=i.text 
      review.append(per_review)
  </code></pre>
  <p><code>len(review)</code></p>
  <p>Here's my attempt at exporting to csv where I get review text ONLY and nothing else:</p>
  <pre><code>with open('Review.csv','a',encoding = 'utf-8') as f:
       for each in review:
            f.write(each+'\n')
  </code></pre>