I'd advise you to learn Regular Expressions.
Opening the file and loading it into an object is simple, from then on Regex will do most of the work for you if you care to learn it.
Don't ignore this, Python coders (and not only on Python, but many other languages) should know Regex.