[Tutor] Building dictionary from large txt file

Roel Schroeven roel at roelschroeven.net
Wed Jul 27 03:39:04 EDT 2022


Op 27/07/2022 om 5:11 schreef Dennis Lee Bieber:

> [...]
> 	I'd probably run a loop inside the open/close section, collecting the
> items for ONE entry. I presume "Atomic Number" starts each entry. Then,
> when the next "Atomic Number" line is reached you process the collected
> lines to make your dictionary entry.
I'd probably do something like that too. But don't forget to also 
process the collected lines at the end of the file! After the last entry 
there is no "Atomic Number" line anymore, so it's easy to inadvertently 
skip that last entry (speaking from experience here... ).

-- 
"Most of us, when all is said and done, like what we like and make up
reasons for it afterwards."
         -- Soren F. Petersen



More information about the Tutor mailing list