Parsing names with pyparsing
- by johnthexiii
I have a file of names and ages,
john 25
bob 30
john bob 35
Here is what I have so far
from pyparsing import *
data = '''
john 25
bob 30
john bob 35
'''
name = Word(alphas + Optional(' ') + alphas)
rowData = Group(name +
Suppress(White(" ")) +
Word(nums))
table = ZeroOrMore(rowData)
print…