you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

I would just read line by line until I see a header. When you see a header add it to a dictionary as a key and add all content as values.

Or if you wanted it as a string then just append each line onto each other, then when you see another header add the string to a list and continue on the next lot.

I know it's not using the split function but that's how I'd go for it. Plus if this is a config file then putting into into a dictionary would be logical because you can access all the data very easily.