On Aug 7, 2008, at 12:52 PM, Mike Driscoll wrote:
I'm well aware of the split() method and built-ins, however since this
appeared to be a homework-type question and I was at work, I didn't
spend any time on the issue. The only reason I mentioned McGuire's
PyParsing module was because I had just finished reading his article
on the subject in Python Magazine and it sounded like something the OP
might find interesting.\

Thanks to everyone that responded, I learned a lot about text parsing from the responses. I just wanted to respond to Mike and let him know that this was not a homework problem. I was given a file in the format by a colleague for a project that I am working on (it contains a list of fields observed by
the LINEAR asteroid search project during 2005 and 2006). I could have
parsed it using slices of each line, but the unusual format of each line
got me thinking about wether there was another way to do it. I had tried a few approaches, but I had not considered the .split() and .split("="). Of course
the list members quickly came up with a simple and elegant solution. And
I learned a lot in the process :)

Cheers
Tommy Grav
+ -----------------------------------------------------------------------------------------------------------------+
  Associate Research Scientist                  Dept. of Physics and Astronomy
  Johns Hopkins University                      Bloomberg 243
  [EMAIL PROTECTED]                                     3400 N. Charles St.
  (410) 516-7683                                        Baltimore, MD21218
+ -----------------------------------------------------------------------------------------------------------------+




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to