title: Trim specific leading and trailing characters from a string
body: <p>I have a string that contains a path
  </p>
  
  <pre><code>str = "/example/path/with/different/trailing/delimiter\"
  </code></pre>
  
  <p>and I want to trim the leading and trailing <code>/</code> and <code>\</code>. What is the best practice in Python 3?</p>
  
  <p>Currently I'm using
  </p>
  
  <pre><code>trimmedPath = str.strip("/\\")
  # trimmedPath is "example/path/with/different/trailing/delimiter" as desired
  </code></pre>
  
  <p>Two questions:</p>
  
  <ol>
  <li>Is this the best trim function for trimming specific characters in Python 3?</li>
  <li>Are there specific path functions for such operations in Python 3 so I don't have to set the delimiters manually?</li>
  </ol>