Feb-15-2019, 08:51 AM
DISCLAIMER: I'm new to python and programming in general(only been coding for a couple days.go.easy.on.me)
I'm trying to write a code that will scrape my website and retrieve [Product Name, Product Price] and write it to a csv file.
when I write it to the csv file the information doesn't go where I want it to go:
![[Image: CSVMESSUP_zpsq3vxqisz.png]](https://i28.photobucket.com/albums/c240/xxxxmarshall_mathersxxxx/CSVMESSUP_zpsq3vxqisz.png)
I'm not getting any errors thank god
I was wondering if someone would be so kind as to review my code and tell me how to make it work the way I'd like.
I'm trying to write a code that will scrape my website and retrieve [Product Name, Product Price] and write it to a csv file.
when I write it to the csv file the information doesn't go where I want it to go:
![[Image: CSVMESSUP_zpsq3vxqisz.png]](https://i28.photobucket.com/albums/c240/xxxxmarshall_mathersxxxx/CSVMESSUP_zpsq3vxqisz.png)
I'm not getting any errors thank god

I was wondering if someone would be so kind as to review my code and tell me how to make it work the way I'd like.
#source variables source = requests.get('https://www.shopshiptrack.com/index.php?route=product/catalog&limit=100').text soup = BeautifulSoup(source, 'lxml') #lists product_lst = [] price_lst = [] #csv creation with open('list.csv', 'w', newline="") as csv_file: csv_writer = writer(csv_file) headers = ['Name', 'Price'] csv_writer.writerow(headers) # code for products_section in soup.find_all('div', class_='name'): product_names = products_section.a.text product_lst.append(product_names) csv_writer.writerow(product_lst) for products_price in soup.find_all('span', class_='price-normal'): specific_price = products_price.text price_lst.append(specific_price) csv_writer.writerow(price_lst)