title: How do I strip all leading and trailing punctuation in Python?
body: <p>I know how to remove all the punctuation in a string. </p>
  
  <pre><code>import string
  
  s = '.$ABC-799-99,#'
  
  table = string.maketrans("","") # to remove punctuation
  new_s = s.translate(table, string.punctuation)
  
  print(new_s)
  # Output
  ABC79999
  </code></pre>
  
  <p>How do I strip all leading and trailing punctuation in Python? The desired result of <code>'.$ABC-799-99,#'</code> is <code>'ABC-799-99'</code>.</p>