title: How to strip a forward slash from a string
body: <pre><code>Python 2.7.3 (default, Apr 20 2012, 22:44:07) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.  
  
  &gt;&gt;&gt; s = "www.example.com/help"
  &gt;&gt;&gt; s.strip('/')
  &gt;&gt;&gt; 'www.example.com/help'    #expected 'www.example.comhelp'
  &gt;&gt;&gt; t = "/blah/blah/"
  &gt;&gt;&gt; t.strip('/')
  &gt;&gt;&gt; 'blah/blah'    #expected 'blahblah'
  &gt;&gt;&gt; s.strip('w.')
  &gt;&gt;&gt; 'example.com/help'    #expected 'examplecom/help'
  &gt;&gt;&gt; f = 'www.example.com'
  &gt;&gt;&gt; f.strip('.')
  &gt;&gt;&gt; 'www.example.com'    #expected 'wwwexamplecom'
  &gt;&gt;&gt; f.strip('comw.')
  &gt;&gt;&gt; 'example'    #as expected
  </code></pre>
  
  <p>Can someone please explain why str.strip doesn't seem to work as promised?</p>
  
  <p>From the documentation:</p>
  
  <blockquote>
    <p>str.strip([chars])</p>
    
    <blockquote>
      <p>Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped:</p>
    </blockquote>
  </blockquote>