The following code can be used to sort a numerical list in Python:
list = [“2”, “5”, “7”, “8”, “1”]
list = [int(i) for i in list]
list.sort()
print (list)