The external text file is named, "dicts from text.txt". The contents of this text file are shown below.
- Each line is read and stored in a temporary list.
- The values are split based on the colon between them.
- Any extra spaces are stripped and the values are added in key:value pairs in the dictionary named "flag_dict".
- The temporary list is cleared after each line is read into the dictionary.
- For this example, I used print statements based on the values; however, computations could be performed based on the values.