Should I be seeing a ' ' around the value of a dictionary?  Like this { 
'BANANAS': '12',  'EITHER': '1', }  ?

At the bottom of this code I zipped two lists together to make a 
dictionary. I am now trying to list them in order of reoccurrence but I 
think I am unable to do this because the values don't have ' ' around them? 
 
If this is the problem could someone tell me how I could get  ' ' around 
the values ?

# Result: {'ALREADY': 1,
 'BANANAS': 12,
 'BEEN': 3,
 'EITHER': 1,
 'GET': 1,
 'HAVENT': 4,
 'I': 5,
 'YOU': 2} # 


''' lists the top three occurring words found in this text file '''

inFile = r'E:\ProfessionalDevelopment\python\Introduction to Python 
Scripting in Maya\week4\simpleLine.txt'
holder=[]     # holds all the words
occurences=[]      # holds a count of the reoccurring words
with open(inFile, 'r') as fin:  
    for line in fin:
        #  removes punctuation
        punctuation=["?","'","\r\n",".","!","-",","]
        for p in punctuation:
            
            line = line.replace(p,"")
            
        wordList = line.upper().split()
        #print wordList




        for word in wordList:
            holder.append(word)


for num in holder:
    occurences.append(holder.count(num))
    
combine = dict(zip(holder, occurences) )

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/16b75e66-a71a-4417-a1fa-a3bc1db88348%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to