Python pyparsing.StringEnd() Examples

The following are 1 code examples for showing how to use pyparsing.StringEnd(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module pyparsing , or try the search function .

Example 1
Project: pds-tools   Author: SETI   File: julian.py    License: Academic Free License v3.0 5 votes vote down vote up
def sec_from_string(string):
    """Returns a second value based on a parsing of a time string."""

    # Give the list zero values for each parameter, in case they are missing
    # from the list returned
    parser = jdp.TIME + pyparsing.StringEnd()
    list = ([["HOUR",0],["MINUTE",0],["SECOND",0]] +
            parser.parseString(string).asList())
    dict = _dict_from_parselist(list)

    return _sec_from_dict(dict)

########################################