I have a textfile of the format (well, it is much less structured, but the parts I need follow the below idea):
[ThisShouldBeAKey]
Value1=yes
Value2=no
Value3=fancywords
Value4=numbers
[ThisShouldBeAnotherKey]
Value2=true
Value3=333
Value5=qqq
I want to convert this file into a dictionary, so that I can easily compare certain values of certain keys. E.g., retrieve Value8 and Value9 of [Key1] and [Key100].
I imagine I can retrieve Value8 and Value9 by simply iterating over a textdump of the [key], and using startswith() or other string functions to retrieve what I want. So, although you could (ideally?) make a nested dictionary, I don't >think< I necessarily require this.
However, I even have trouble simply getting a dictionary of [Key]:Value1Value2Value3AllthevaluesTextdump. I have tried a few things on my own, I have tried the suggestion here ( In Python, how do I read a file into a dictionary with multiple line entries? ) and alterations on it, but I always run into a problem with for-loops, while-loops, or the file simply not being read properly.
How would you recommend doing this?
Thank you in advance!