Parsing a key value text file

Page 1 of 1

0 Replies - 293 Views - Last Post: 31 January 2013 - 08:33 AM Rate Topic: -----

#1 Fosh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 31-January 13

Parsing a key value text file

Posted 31 January 2013 - 08:33 AM

Hello everyone,

I have come across a fixed formatted file that I need to parse in python. An example of the file would be something like this:

"user" "jdoe" = {
"mail" "\"john.doe@something.com\""
"displayname" "\"John Doe\""
}

"user" "crock" = {
"mail" "\"chris.rock@something.com\""
"displayname" "\"Chris Rock\""
}

The idea is that I could get the user name and the attributes assigned to variables for further processing. I was hoping that I could get some pointers to nudge me in the right direction. Right now I am thinking about regular expressions, but I don't know if that is the right direction or not. Has anyone else ever done something like this before?

Thanks in advance

Is This A Good Question/Topic? 0
  • +

Page 1 of 1