Reading Formatted Text File

Andrew James drew at gremlinhosting.com
Sat Nov 20 15:02:02 CET 2004


Kevin,
There was an article on parser generators in this mailing list a couple
of days ago - given the relative complexity of the format you've shown
below you might try simple regex matching but only if you know all the
input is valid.

Some places you might want to look:
http://christophe.delord.free.fr/soft/tpg/ - Parser generator
http://dparser.sourceforge.net/ - Another parser generator (both are
excellent)

And, of course, diveintopython's most excellent regular expression
tutorial:

http://www.diveintopython.org/regular_expressions/index.html

Hope this helps!

Regards,
Andrew


On Sat, 2004-11-20 at 05:34 -0800, Kevin McBrearty wrote:
> Hello All,
> 
> I'm trying to read a formatted text of strings and
> floats.  I have looked through previous posts and
> couldn't deciper a good method.  I'm new to python so
> any suggestions would be helpful.
> 
> Regards,
>         Kevin
> 
> solid SIMPLEBLOCK
>   facet normal 0.000000e+00 0.000000e+00 -1.000000e+00
>     outer loop
>       vertex 1.000000e+00 -1.000000e+00 0.000000e+00
>       vertex -1.000000e+00 -1.000000e+00 0.000000e+00
>       vertex -1.000000e+00 1.000000e+00 0.000000e+00
>     endloop
>   endfacet
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - Get yours free! 
> http://my.yahoo.com 
> 
> 
-- 
Andrew James <drew at gremlinhosting.com>




More information about the Python-list mailing list