Learning Python: Dr Ch.uck Se.veran.ce class assignment TenDot2.

Purpose of this exercise is to extend to using tuple to store a list of variables and sort them up. The key parts are using "append" and then "sort"

fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "XXmboXshort.txt"

fh = open(fname)
count = 0
count_dict = dict()
my_list = list()
for line in fh :
    if line.startswith('From '):
        line_words = line.split()
        #print line_words[5]
        hour = line_words[5].split(':')[0]
#print hour
count_dict[hour] = count_dict.get(hour, 0) + 1
count = count + 1
#        print count_dict
for k,v in count_dict.items(): ## Get a list of dictionary.
my_list.append( (k,v))  ##This is the key part and translating the list to tuples.
# print my_list
my_list.sort(reverse=False)

for k,v in my_list:
    print k,v