title: Remove punctuation from a list
body: <p>I'm working on taking a sample of the Declaration of Independence and calculating the frequency of the length of words in it. </p>
  
  <p>Sample text from file:</p>
  
  <pre><code>"When in the Course of human events it becomes necessary for one people to dissolve the political bands which have connected them with another and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires 
  that they should declare the causes which impel them to the separation."
  </code></pre>
  
  <p>Note: The word length cannot include any punctuation e.g. anything from string.punctuation.</p>
  
  <p>Expected Outcome (sample):</p>
  
  <pre><code>Length Count
  1 16
  2 267
  3 267
  4 169
  5 140
  6 112
  7 99
  8 68
  9 61
  10 56
  11 35
  12 13
  13 9
  14 7
  15 2
  </code></pre>
  
  <p>I'm currently stuck on removing punctuation from the file that I've converted into a list.</p>
  
  <p>Here is what I've tried so far:</p>
  
  <pre><code>import sys
  import string
  
  def format_text(fname):
          punc = set(string.punctuation)
          words = fname.read().split()
          return ''.join(word for word in words if word not in punc)
  
  try:
      with open(sys.argv[1], 'r') as file_arg:
          file_arg.read()
  except IndexError:
      print('You need to provide a filename as an arguement.')
      sys.exit()
  
  fname = open(sys.argv[1], 'r')
  formatted_text = format_text(fname)
  print(formatted_text)
  </code></pre>