Exercise: read section


  • Create an iterator that given the name of a file like the following, will return once section at a time.
  • It will return a list one each iteration and each element of the list will be a line from the current section.
  • Other ideas what should be returned on each iteration?


examples/iterators/sections/planets.txt

name     = Mercury
distance = 0.4
mass     = 0.055


name     = Venus
distance = 0.7
mass     = 0.815


name     = Earth
distance = 1
mass     = 1

name     = Mars
distance = 1.5
mass     = 0.107