I'm creating a book index and I have read in a text file of words and their pages and have created this dictionary called 'index'
index={'spanning tree': {16, 99}, 'vertex': {54}, 'depth first search': {55}, 'shortest path': {55}, 'connected': {28, 54}, 'neighbor': {64, 27, 77}, 'path': {72, 19}}
Now I want to alphabetize the keys and put the numbers in chronological order- Am I able to do this in the dictionary format or do I need to convert it to a list or a string?
I tried doing this...
ind=list(index)
ind.sort()
return ind
and I got a list of the keys in alphabetical order but am not sure how to approach the numbers because they are in sets...
Any advice?