How to extract data to csv files with Python BeautifulSoup

Havid Riyono
1 min readAug 11, 2021

--

In the previous article we have tried to do data scraping in python.

Install library with pip

pip install requests
pip install beautifulsoup4

Process

1. Found a container will all the data.
2. Used nested for loops whenever data is not extracted fully.

Code

Now I will share the results of my study about extracting data into csv files after we scrape data with python with beautifulsoup

  1. First open the Pycharm IDE (I use pycharm to write the code)
  2. Create a project. Here I create a carousell project name.
    Since we will be to extract web data carousell.com with categories book and stationary
  3. Write / Copy the following code

4. Once completed we run the results of the coding that has been made

5. Results extract the data will appear in the project with the following csv format

Source :
https://github.com/havidri/Carousell

--

--

Responses (1)