title: Python function to modify string
body: <p>I was asked once to create a function that given a string, remove a few characters from the string.</p>
  
  <p>Is it possible to do this in Python?</p>
  
  <p>This can be done for lists, for example:</p>
  
  <pre><code>def poplist(l):
      l.pop()
  
  l1 = ['a', 'b', 'c', 'd']
  
  poplist(l1)
  print l1
  &gt;&gt;&gt; ['a', 'b', 'c']
  </code></pre>
  
  <p>What I want is to do this function for strings.
  The only way I can think of doing this is to convert the string to a list, remove the characters and then join it back to a string. But then I would have to return the result.
  For example:</p>
  
  <pre><code>def popstring(s):
      copys = list(s)
      copys.pop()
      s = ''.join(copys)
  
  s1 = 'abcd'
  
  popstring(s1)
  
  print s1
  &gt;&gt;&gt; 'abcd'
  </code></pre>
  
  <p>I understand why this function doesn't work. The question is more if it is possible to do this in Python or not? If it is, can I do it without copying the string?</p>