Hello, When I'm using the 'open' function how should I specifiy the directory ? I'm getting an IOError and bit of confused! I'm not sure if my script is wrong or I've problems with specifying the directory.
input = open('New.txt', 'r')
text = input.read()
wordlist = text.split()
wordfreq = [wordlist.count(p) for p in wordlist]
dictionary = dict(zip(wordlist,wordfreq))
aux = [(dictionary[key], key) for key in dictionary]
aux.sort()
aux.reverse()
for a in aux: print a
If someone has a very simple version for the above script, please let me know. I'm trying to write a procedure that accepts a file name from the user, builds a frequency listing of the characters contained in the file, and prints a sorted and formatted character frequency table to the screen. Looking forward to your advise. Thank you.