Skip to main content

A simple package to parse CSV

Project description

Simple CSV parser

This is a simple package designed to serialize and deserialize CSV.

Installing

Use Python PIP

pip install SimpleCSVParser

Usage

The package contains a single class which is CSVFile that represents a CSV file.

from SimpleCSVParser import CSVFile


# create a new instance from a file.
parsed_csv: CSVFile = CSVFile.from_file("my_csv_file.csv")
# you can also create a new instance from a raw string.
parsed_csv = CSVFile("your;csv;here\n1;2;3")

# You can also specify the separator in a second arugment.
parsed_csv: CSVFile = CSVFile.from_file("my_csv_file.csv", ';')
parsed_csv = CSVFile("your;csv;here\n1;2;3", ';')

# Obtain a specific element, the second argument being 
# the row number not taking the column name into account.
parsed_csv[("Column Name", 0)]

# Obtain a list[list[any]] of the serialized CSV, the first
# column being the column names so, row[column[any]].
parsed_csv.get_raw()

# Obtain a string from the CSV instance.
parsed_csv.to_string()

# You can optionally specify if it's going to add the 
# separator specifier if so, it's going to append 
# "sep={separator}" to the start.
parsed_csv.to_string(True) # default being true.

# There is also a shortcut for writing the CSV to a file.
parsed_csv.write_to_file("./path_to_file.csv")

# And of course define if it's going to specify the separator.
parsed_csv.write_to_file("./path_to_file.csv", True) # default being true.

Contributing

You can make a pull request, and it will be checked as soon as possible.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simplecsvparser-0.0.4.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplecsvparser-0.0.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file simplecsvparser-0.0.4.tar.gz.

File metadata

  • Download URL: simplecsvparser-0.0.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for simplecsvparser-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3d73cebdc2a98d203321cc2c77fb7d97bc06651f77c7f54b97df3f4d134413d9
MD5 9d52f4b2f893be1ac6fc343b90cc8dd2
BLAKE2b-256 f58478e3dbe28498a01478522e69243b5d3e9ad94a040ddb5fdfcdaaa4700dc9

See more details on using hashes here.

File details

Details for the file simplecsvparser-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for simplecsvparser-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 26326080cd1d5204673f7e1b0173e9b66202847200c8aa6f7282ae092e065d54
MD5 cb6d2e211722fa92de0a1b0e7f3e9178
BLAKE2b-256 fc20f96927e5e5ac42099cd3b51e723dd293457bd87d5d00fedd50cac7fd713d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page