Python Forum
Parse String between 2 Delimiters and add as single list items
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parse String between 2 Delimiters and add as single list items
#1
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.
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))
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"}
Reply


Messages In This Thread
Parse String between 2 Delimiters and add as single list items - by lastyle - Apr-11-2021, 09:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Delimiters - How to skip some html tags from being translate Melcu54 0 300 May-26-2021, 06:21 AM
Last Post: Melcu54
  Feed List items with Integer euras 9 593 May-19-2021, 07:45 PM
Last Post: snippsat
  Sum of list items tristanfermat 2 529 Feb-06-2021, 12:04 PM
Last Post: tristanfermat
  convert List with dictionaries to a single dictionary iamaghost 3 635 Jan-22-2021, 03:56 PM
Last Post: iamaghost
  How to append multiple <class 'str'> into a single List ahmedwaqas92 2 584 Jan-07-2021, 08:17 AM
Last Post: ahmedwaqas92
  Undo interation to make a single list? DustinKlent 2 508 Nov-29-2020, 03:41 AM
Last Post: DustinKlent
  Count number of occurrences of list items in list of tuples t4keheart 1 582 Nov-03-2020, 05:37 AM
Last Post: deanhystad
  concatenating 2 items at a time in a python list K11 3 591 Oct-21-2020, 09:34 AM
Last Post: buran
  Using lambdas and map() to parse substrings in a single line Drone4four 5 1,121 Sep-20-2020, 10:38 AM
Last Post: snippsat
  Select the other of 2 items in a list Clunk_Head 7 1,017 Sep-01-2020, 05:27 PM
Last Post: Clunk_Head

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020