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`



# this line will be ignored


Project details

Download files

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

Source Distribution

simple-categories-0.1.1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

simple_categories-0.1.1-py3-none-any.whl (10.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page