Python Basics: Reading Data From CSV File

Опубликовано: 19 Март 2026
на канале: Coding is for girls
51,896
983

Let’s create a script that is actually useful. Load of us use Spreadsheets or Excel files to store some data. What about reading the data and performing some tasks for each row from the table? Today I will show you how to generate a CSV (Comma Separated Value) file and how to read it in Python. This video will be useful for the next video, where we will actually send e-mails to all people listed in spreadsheet.

✅💻 Extra homework
The script I showed you is a simple version that does not take into account some edge cases and problems with data. Here is some list of things you might want to consider and check if you could fix them on your own:
your script expects 5 variables in each row from CSV. What if you have more or less values? Try to create CSV without Language column and/or add one extra column, for example birthday.
what if your data contains either “Yes”, “yes”, “Y”, “y”, “1” to indicate that someone is accepted. Can you make your script to work with many different variation of data in this column?
what if one of the values we use: name, coach or email is empty? Can you make sure that we do not display line about the coach for accepted people if there is no coach name provided?
what if the "applications.csv" files does not exists? Could you make the script not crash and display some nice, meaningful information?

💁💻 My social media:
Twitter:   / codingisforgirl  
Facebook:   / codingisforgirls  

🐍📖 Check these resources to learn more:
Python documentation about csv standard module: https://docs.python.org/3/library/csv...
Django Girls Tutorial: http://tutorial.djangogirls.org/

🎬🐍 Python Basics Playlist (if you want to start from the very beginning):
   • Python Basics