I am trying to sort a result I write into an output file after a certain character ':' by the integer after the character.
First, I tried using sort function but it did not work as it was not a list. I also tried to convert everything to string list and tried to sort accordingly but do not think it’s the most efficient way to go.
NOTE: output file lines are all strings
**Current written output in output_file1.txt:**
hi: 011
hello: 000
hero: 001
You are done!
**Expected written output in output_file1.txt:**
hello: 000
hero: 001
hi: 011
You are done!
Thank you for your help.