Apr-11-2021, 09:52 PM
(Apr-11-2021, 09:41 PM)bowlofred Wrote: Except for not having brackets around it, this appears to be valid JSON. I'd add the brackets and parse as JSON. That will give you a list of dicts that you can read.
import json file = open('csdb.rss', mode='r') json_string = "[" + file.read().rstrip() + "]" data = json.loads(json_string) print(f"The first element is {data[0]}") print("The keys and values in the first element are:") for k, v in data[0].items(): print(f"{k} => {v}")
ouch my Bad, i posted to the wring Subcategory. My python version is 2.7.18 There the Syntax is different and i get the error
File "F:\GP\C64\BBS\csdbrss\grabcsdb.py", line 34
print(f"The first element is {data[0]}")
^
SyntaxError: invalid syntax