A simple utility that converts and combines a folder of .ini files with identical keys into one csv file. The keys of the .ini files become the headers of the csv file, and the values of each file become a row.
ini2csv is available on PyPI and can be installed using pip:
pip install ini2csv
To use ini2csv, the library needs to first be imported in your project:
import ini2csv
ini2csv has two main interface functions: process_folder
and process_files
Each of these functions take two arguments. process_folder
takes in the folder name and output .csv file name as arguments. process_files
similarly takes a list of file names and output .csv file name as arguments.
# Argument list
process_folder(folder_name: str, output_filename: str)
process_files(file_names: List[str], output_filename: str)
Suppose you have a folder of .ini files, where each file contains data for one instance of an item. Each file thus represents one row in a .csv file, and each key in the file represents the headers in the .csv file. A folder of such .ini files can then be converted into a csv file and saved for ease of other pre-existing data-processing pipelines.