I have a .txt file, with the following formatted content:
------------------------
Fruit 1:
Name: apple
Color: green
Taste: sour
Property 4: yes
------------------------
Fruit 2:
Name: strawberry
Color: red
Seeds: yes
------------------------
Fruit 3:
...
# note: various "Fruit" has different properties and different numbers of properties.
I want to read "Fruit (with its all contents) by Fruit", no matter how many properties each "Fruit" has, I want to read each of them (Fruit) one by one, but not 'line by line'.
Does anyone have a hint on what function or class I can use to read a .txt file in this way? thanks!
Update:
The expected result is saving each Fruit's content into a list with string, for example:
Fruit 1 =[" Name: apple", " Color: green", " Taste: sour", " Property 4: yes"]
Fruit 2 =[" Name: strawberry", " Color: red", " Seeds: yes"]
Fruit 3 = [...]