Skip to main content

Reads a categorized file and returns a dictionary

Project description

Reads lines from a plaintext file, separated by categories.

To use use it, install the package and import on your project with

import catlist

Then read a file with

categories = catlist.catlist(file_name)

Category names are delimited by square brackets as the first and last characters of the line.

Items in each category are just plain text, one item per line

Any lines before the first category will be assigned to 'uncategorized'

The format is simmilar to .ini files, only you don't have thei 'key'='value' structure in the items.

Blank lines and lines that begin with '#' are ignored.

Example of a file:

# the following lines will be assigned to 'uncategorized`

Linux
Windows
MacOS

[Directories]
/home
/usr
/etc

# this line will be ignored

[Files]
README.md
module.py

Project details


Download files

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

Files for simple-categories, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size simple_categories-0.1.2-py3-none-any.whl (9.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size simple-categories-0.1.2.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page