CSV

CSV data is very widely used in the cyber security and data science domain, whether in the form of log files, as an output of Nessus or Qualys reports (in Excel format), or large datasets for machine learning. Python provides excellent support for CSV files with the built-in CSV module. In this section, we shall explore this module and look at the pandas Python utility with a focus on CSV.

Let's first look at the built-in CSV module offered by Python. The following code snippet, called csv_parser.py, demonstrates this module:

The preceding code helps us understand how we can use the CSV module to read CSV files in Python. It's always ...

Get Hands-On Penetration Testing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.