OT: novice regular expression question

It's me itsme at yahoo.com
Fri Dec 31 01:48:36 EST 2004


The shlex.py needs quite a number of .py files.  I tried to hunt down a few
of them and got really tire.

Is there one batch of .py files that I can download from somewhere?

Thanks,


"M.E.Farmer" <mefjr75 at hotmail.com> wrote in message
news:1104436491.861213.310070 at z14g2000cwz.googlegroups.com...
> Hello me,
> Have you tried shlex.py it is a tokenizer for writing lexical
> parsers.
> Should be a breeze to whip something up with it.
> an example of tokenizing:
> py>import shlex
> py># fake an open record
> py>import cStringIO
> py>myfakeRecord = cStringIO.StringIO()
> py>myfakeRecord.write("['1','2'] \n 'fdfdfdfd' \n 'dfdfdfdfd'
> ['1','2']\n")
> py>myfakeRecord.seek(0)
> py>lexer = shlex.shlex(myfakeRecord)
>
> py>lexer.get_token()
> '['
> py>lexer.get_token()
> '1'
> py>lexer.get_token()
> ','
> py>lexer.get_token()
> '2'
> py>lexer.get_token()
> ']'
> py>lexer.get_token()
> 'fdfdfdfd'
>
> You can do a lot with it that is just a teaser.
> M.E.Farmer
>





More information about the Python-list mailing list