Convert Python data structures to CSV format
Project description
csv-stringify
A Python package for converting data to CSV text format.
Installation
pip install csv-stringify
Usage
Basic Usage
from csv_stringify import stringify
output = stringify([
["1", "2", "3", "4"],
["a", "b", "c", "d"],
], header=False)
print(output) # "1,2,3,4\na,b,c,d\n"
More Examples
from csv_stringify import stringify
# Basic usage
data = [["1", "2", "3"], ["a", "b", "c"]]
csv_string = stringify(data, header=False)
print(csv_string) # "1,2,3\na,b,c\n"
# With headers
csv_string = stringify(data, columns=["A", "B", "C"])
print(csv_string) # "A,B,C\n1,2,3\na,b,c\n"
# From dictionaries
data = [{"name": "John", "age": 25}]
csv_string = stringify(data)
print(csv_string) # "name,age\nJohn,25\n"
API
stringify(data, **options)
Convert data to CSV string.
Parameters:
data
: List of lists or list of dictionariescolumns
: List of column names (optional)header
: Include header row (default: True)delimiter
: Field delimiter (default: ',')quote_char
: Quote character (default: '"')quote_mode
: Quoting mode (default: 'minimal')
Returns: CSV string
Requirements
- Python 3.7+
- No external dependencies
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
csv_stringify-1.0.0.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file csv_stringify-1.0.0.tar.gz
.
File metadata
- Download URL: csv_stringify-1.0.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
055d8530b41ddcd5c705553f50915ec5d8cce61a4a7487a6c21152bbe54db47d
|
|
MD5 |
d4ce829e4f0d9ddf8caef45637b29596
|
|
BLAKE2b-256 |
973ee3b1e9059e1cb8e249313e05b2bed52f9771bea84d27a1698e55fd39d2e3
|
File details
Details for the file csv_stringify-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: csv_stringify-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
96d5d2d803aafd53d62305471f1447324c9aac29aa22a8dcd8fe0d7e3693e57d
|
|
MD5 |
5be50aa99cadb0b4033f108ebdb0b097
|
|
BLAKE2b-256 |
763c55e4180f5828447506d4d403ba4e3a63446556858406d886eaa75204b759
|