Skip to content

Monthly Archives: November 2007

Kew

On a lovely autumn day, I went to see the Henry Moore statues at Kew gardens.
Here are the pictures :

Using pyparsing – 2

Parsing sql statements like the following is dead simple with PyParsing.

INSERT INTO table_a VALUES (’A', ‘B’, ‘C’);
INSERT INTO table_a VALUES (’D', ‘E’, ‘F’);

This is the program :

from pyparsing import Suppress, delimitedList, sglQuotedString, removeQuotes
 
sglQuotedString.setParseAction( removeQuotes )
stmt = Suppress("INSERT INTO table_a VALUES (") + delimitedList(sglQuotedString) \
[...]