Apr-11-2021, 09:24 PM
Hi all.
I`ve got a big string that contains multiple different data. The dataitems are seperated by {data}
I want to grab the data between theese 2 delimiters { and } and add them as a single item to another list.
i was using the code.
but this didnt work and added the whole content as just one list item. How should i call it parser correctly ? or as alternative read the file and parse it while reading and then append to the list as items ?
a sample sting is like :
{"name":"Freaky Fish DX +3PD [retailversion]","id":"202669","category":0,"group":"Onslaught","year":2021,"handle":"Shocker,Bieno64,Didi,Jazzcat","rating":0,"updated":"2021-04-07","released":"2021-04-06"},{"name":"Mimizuku Saga 10","id":"202614","category":0,"group":"Commocore","year":2021,"handle":"Bago Zonde","rating":0,"updated":"2021-04-07","released":"2021-04-05"},{"name":"Big Time Bugger","id":"202613","category":0,"group":"Commocore","year":2021,"handle":"Bago Zonde","event":"Cassette 50 Charity Competition","rating":0,"updated":"2021-04-05","released":"2021-03-30"}
I`ve got a big string that contains multiple different data. The dataitems are seperated by {data}
I want to grab the data between theese 2 delimiters { and } and add them as a single item to another list.
i was using the code.
1 2 3 4 5 |
file = open ( 'csdb.rss' ,mode = 'r' ) # read all lines at once all_of_it = file .read() data = [] data.append( re.findall(r '\{({^}}*)\}' , all_of_it)) |
a sample sting is like :
{"name":"Freaky Fish DX +3PD [retailversion]","id":"202669","category":0,"group":"Onslaught","year":2021,"handle":"Shocker,Bieno64,Didi,Jazzcat","rating":0,"updated":"2021-04-07","released":"2021-04-06"},{"name":"Mimizuku Saga 10","id":"202614","category":0,"group":"Commocore","year":2021,"handle":"Bago Zonde","rating":0,"updated":"2021-04-07","released":"2021-04-05"},{"name":"Big Time Bugger","id":"202613","category":0,"group":"Commocore","year":2021,"handle":"Bago Zonde","event":"Cassette 50 Charity Competition","rating":0,"updated":"2021-04-05","released":"2021-03-30"}