Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

VERTICALTABLE structured text parser

Project Description

This is an structured text parser.

format

example 1:

source:

[Q] This is a question.
[A] This is an answer.
[Q] This is a question2.
# This is comment
[A] This is an answer2.

parsed:

[
  {
    'Q': 'This is a question.',
    'A': 'This is an answer.',
  },
  {
    'Q': 'This is a question2.',
    'A': 'This is an answer2.',
  },
]
  • If the same key appeared, Next record.
  • Actuary, output is OrderedDict list. Not Dict list.

source:

[Key1]
Value1
[Key2]
Value2
----
[Key3]
Value3
next line
next line
[Key4]

Value4    4!

[Key5]
Value5

parsed:

[
  {
    'Key1': 'Value1',
    'Key2': 'Value2',
  },
  {
    'Key3': 'Value3\nnext line\nnext line',
    'Key4': 'Value4    4!',
    'Key5': 'Value5',
  }
  • Whitespace trimmed.
  • “—-” (Hyphens >= 4) is list separator.

usage

import verticaltable

fp = open('sample.txt')

parsed_list = verticaltable.loads(fp.read())

parsed_list2 = verticaltable.load(open('sample2.txt'))

Release History

This version
History Node

0.1.0

Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
verticaltable-0.1.0.tar.gz
(1.7 kB) Copy SHA256 Hash SHA256
Source None May 17, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting