BCP Reader
A reader for BCP-format data files. BCP files are similar to CSV files but contain a multi-character line and field delimiters. The default delimiters used are:
- field delimiter:
@**@ - line delimiter:
*@@*
Python's csv module can only deal with single character delimiters, so this
module has a reader function and DictReader class which should be drop-in
replacements for python's csv module equivalents.
Credits
The author of the main method is Gertjan van den Burg of the Alan Turing Institute. It was based on a method originally developed by David Kane at NCVO.
Installation
Install with pip install bcp-reader
Usage
The module can be used by importing from the bcp module in a python script:
import bcp
with open('path_to_bcp_file.bcp') as f:
bcpreader = bcp.reader(f)
for row in bcpreader:
print(row)
# ["Value 1", "Value 2"]
with open('path_to_bcp_file.bcp') as f:
bcpreader = bcp.DictReader(f, fieldnames=["field 1", "field 2"])
for row in bcpreader:
print(row)
# {"field 1": "Value 1", "field 2": "Value 2"}
You can also use it via the command line to convert a BCP file to CSV:
bcp path_to_bcp_file.bcp > csv_output.csv
Metadata
Release files for bcp-reader 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bcp-reader-0.1.1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bcp_reader-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / bcp-reader-0.1.1.tar.gz
| Download URL | bcp-reader-0.1.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc49c70561eca1d3b8869c795b3569907e086818d6fb6f95d44ae803a7b9afbf
|
|
BLAKE2b-256 checksum How to use checksums |
a21f634e684fec5c29033c72501acd0043d342591903fb60cde47e7ff3519ba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
|
Release files / bcp_reader-0.1.1-py3-none-any.whl
| Download URL | bcp_reader-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dae2ea7e3218b5fcf27ddd8de83f775a77618bf2259166ca7ecb7f073b59907
|
|
BLAKE2b-256 checksum How to use checksums |
2412329f1468230a50cdb61aff5add9cd66c383e2c4876eadd2084ae95569f17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
|