I have a text file containing first and last ‘syllables’, demarcated with [part1] and [part2]:
[part1] Ae Di Mo Fam [part2] dar kil glar tres
All I want to do is pick a random line, between [part1] and [part2], and then another random line between [part2] and the end of the file, and concatenate the two together (e.g. “Aedar”, “Moglar”) to create random names.
However I am unsure how to parse the text file effectively with readline(). Is there a better way than scanning through each line sequentially, and storing all of them in a list from whence I can pick a random element?
Serialize (pickle) a dictionary to a file instead.
Example: