Name: Anonymous 2011-01-23 14:50
Newbie to Python here
I made a function that calculates distribution of certain characters in any given text file and saves them in another *.txt file like so 'character' + '\t' + percentage + '\n'
And now I'm trying to write the characters and their distribution percentages from that *.txt file to a new dictionary which takes the character as keys, and percentages as values.
I can't figure out how to transfer the files from that document to the dictionary...
to visualize:
def read_dist(filename):
dictdist={}
#### This part here ####
return dictdist
I made a function that calculates distribution of certain characters in any given text file and saves them in another *.txt file like so 'character' + '\t' + percentage + '\n'
And now I'm trying to write the characters and their distribution percentages from that *.txt file to a new dictionary which takes the character as keys, and percentages as values.
I can't figure out how to transfer the files from that document to the dictionary...
to visualize:
def read_dist(filename):
dictdist={}
#### This part here ####
return dictdist