Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Parsing a key value text file

$
0
0
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

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>