Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
csvprint
A command-line utility for pretty printing csv files and converting to other formats.
If Python 3 with the package manager pip is installed, doing pip3 install csvprint
in your terminal should do the trick.
With pipenv installed.
pipenv install
pipenv shell
pip install -e .
csvprint [filename]
prints a formatted table if filename
is a comma separated file.
» cat imdb.csv
Title,Release Year,Estimated Budget
Shawshank Redemption,1994,$25 000 000
The Godfather,1972,$6 000 000
The Godfather: Part II,1974,$13 000 000
The Dark Knight,2008,$185 000 000
12 Angry Men,1957,$350 000
» csvprint imdb.csv
Title Release Year Estimated Budget
Shawshank Redemption 1994 $25 000 000
The Godfather 1972 $6 000 000
The Godfather: Part II 1974 $13 000 000
The Dark Knight 2008 $185 000 000
12 Angry Men 1957 $350 000
You can also pipe into csvprint
:
» cat imdb.csv | csvprint
Title Release Year Estimated Budget
Shawshank Redemption 1994 $25 000 000
The Godfather 1972 $6 000 000
The Godfather: Part II 1974 $13 000 000
The Dark Knight 2008 $185 000 000
12 Angry Men 1957 $350 000
Command | Result |
---|---|
-a | specify alignment (left or right) - see examples below |
-c | specify which columns to print |
-h | print help message |
--markdown | print as markdown |
--latex | print as latex table |
--numeric [c1:d1] [c2:d2] ... | specify decimal numbers for chosen numeric columns (c for column, d for digits) |
--header | add header decoration around the first line |
-s 'char' | file is delimited by char (instead of comma), tab for tab |
-p [n] | add a padding of n spaces for each column, on both sides |
-d [string] | specify the string to separate columns |
There are three options for specifying alignment. One can use l
or r
for aligning all cells to the left or right, respectively. One can also specify a distinct alignment option for each column. Then the number of options will need to match the number of columns.
» csvprint imdb.csv -a l r r
Title Release Year Estimated Budget
Shawshank Redemption 1994 $25 000 000
The Godfather 1972 $6 000 000
The Godfather: Part II 1974 $13 000 000
The Dark Knight 2008 $185 000 000
12 Angry Men 1957 $350 000
Markdown output also supports left and right alignment.
» csvprint examples/imdb.csv --markdown -a l r r
Title | Release Year | Estimated Budget
:----------------------|-------------:|----------------:
Shawshank Redemption | 1994 | $25 000 000
The Godfather | 1972 | $6 000 000
The Godfather: Part II | 1974 | $13 000 000
The Dark Knight | 2008 | $185 000 000
12 Angry Men | 1957 | $350 000
When rendered as HTML, this looks like
Title | Release Year | Estimated Budget |
---|---|---|
Shawshank Redemption | 1994 | $25 000 000 |
The Godfather | 1972 | $6 000 000 |
The Godfather: Part II | 1974 | $13 000 000 |
The Dark Knight | 2008 | $185 000 000 |
12 Angry Men | 1957 | $350 000 |
» csvprint examples/numeric.csv
measure1 measure2
1.2323 9000
1.299 9000001
» csvprint examples/numeric.csv --numeric 1:1 2:1
measure1 measure2
1.2 9000.0
1.3 9000001.0
Run pytest
while in the root directory of this repository.
FAQs
Print csv files in columnated format, either plain or as a Markdown or LaTeX table
We found that csvprint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.