Skip to main content

# detect_delimiter

## About

Detects the delimiter used in CSV, TSV and other ad hoc file formats.

## Installation

Use pip install detect_delimiter

## Usage

detect_delimiter exposes the detect() functinon, which takes a str as input and returns a delimiter.

>>> from detect_delimiter import detect
>>> detect("looks|like|the vertical bar\n is|the|delimiter\n")
'|'

When detect() doesn’t know, it returns None:

>>> text = "not really any delimiters in here.\nthis is just text.\n"
>>> detect()

It’s possible to provide a default, which will be used in that case:

>>> detect(text, default=',')
','

By default, detect() will prevent avoid checking alpha-numeric characters and the period/full stop character (“.”). This can be adjusted via the blacklist parameter.

If you believe that you know the delimiter, it’s possible to provide a list of possible delimiters to check for via the whitelist parameter. If you don’t provide a value, [‘,’, ‘;’, ‘:’, ‘|’, ‘t’] will be checked.

## Testing

You can either use pytest or tox directly from the project’s root directory.

Download files

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

Source Distribution

detect_delimiter-0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

detect_delimiter-0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file detect_delimiter-0.1.tar.gz.

File metadata

  • Download URL: detect_delimiter-0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for detect_delimiter-0.1.tar.gz
Algorithm Hash digest
SHA256 37ce7cfeabede50555f8475093f0704205649feba6568da9c05cfb847e843f61
MD5 15f60c48f2246c41ec336f74a4814c69
BLAKE2b-256 ac9fdcb68ff9444cf3adb82b326bd57a6e5e1f67032514407deceead5124a4d8

See more details on using hashes here.

File details

Details for the file detect_delimiter-0.1-py3-none-any.whl.

File metadata

  • Download URL: detect_delimiter-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for detect_delimiter-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4924e19013510c03c2f28be9a963244d1002b3376ddb98d0b44dee91fe2d4c64
MD5 0fbf7d2c3699eff2de916607eed6a0e6
BLAKE2b-256 ad7610dcb7a65aebb8ec4bca827e9151bcb50cd79899f3764e6cff05309033ae

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page