Version 1 (modified by 15 years ago) ( diff ) | ,
---|
pyparsing can be found in the trunk from revision 684 onwards.
pyparsing providers a simple way of creating parsers for logical text patterns.
A simple tutorial for pyparsing could be found at : http://www.rexx.com/~dkuhlman/python_201/python_201.html#SECTION007600000000000000000
Documentation for pyparsing is located at : http://crpppc19.epfl.ch/doc/python-pyparsing/HowToUsePyparsing.html
Example usage is shown below.
from pyparsing import delimitedList,Word,alphanums,ParseException,Group from pyparsing import Suppress,nums resource = delimitedList(Word(alphanums+"_"),'/') phone = Word(nums) # doesnot accept country code yet address = (Suppress("eden.")+resource) | phone | Word(alphanums+"_ . + @ ") addresses = delimitedList(Group(address)) string = "eden.pr_person/1/asd,eden.la/1/1,9935648569" add = addresses.parseString(string) print add ------------ ==> Result [['pr_person', '1', 'asd'], ['la', '1', '1'], ['9935648569']]
Note:
See TracWiki
for help on using the wiki.