title: python -- trying to count the length of the words from a file with dictionaries
body: <pre><code>def myfunc(filename):
      filename=open('hello.txt','r')  
      lines=filename.readlines()
      filename.close()
  lengths={}
  for line in lines:
      for punc in ".,;'!:&amp;?":
          line=line.replace(punc," ") 
      words=line.split() 
      for word in words:
          length=len(word)
          if length not in lengths:
              lengths[length]=0 
          lengths[length]+=1 
  for length,counter in lengths.items():
      print(length,counter)
  filename.close()
  </code></pre>