thank you in advance for helping me out.
What I want to learn is how to output each sublist into a cell in csv file here are my codes
from bs4 import BeautifulSoup
import urllib.request
import re
import csv
import pandas as pd
rating = []
#first page
url = 'https://www.yelp.com/biz/madame-vo-new-york'
ourUrl = urllib.request.urlopen(url)
soup = BeautifulSoup(ourUrl,'html.parser')
for i in soup.find_all('li', {'lemon--li__373c0__1r9wz margin-b3__373c0__q1DuY padding-b3__373c0__342DA border--bottom__373c0__3qNtD border-color--default__373c0__3-ifU'}):
rating.append(re.findall('.*[="](.* star rating).*', str(i)))
rating = '\n'.join(str(line) for line in rating)
df = pd.DataFrame({'reviewRating': [rating]})
df.to_csv('c1.csv', index = False)
Here are the output results in 'c1.csv': image1
What I want is to look like this:image2
============same-day update===============
As per SOURAV KUMAR's answer, after I changed my code to
df = pd.DataFrame({'reviewRating': rating})
Here is the result:image3 Which is still not what it shows in "image2"
rating = '\n'.join(str(line) for line in rating)and then make the change as per SOURAV's answer.