title: Replace certain characters in stream
body: <p>I have a method (a .yml parser) that takes an input stream as input.  The problem is that it throws errors when it encounters certain characters in certain places e.g. <code>%</code>.</p>
  
  <p>What I would like to do is take the stream, replace all of the <code>%</code> with a place holder, and then pass it to the parser.</p>
  
  <p>This is what I have (which doesn't work with the current input):</p>
  
  <pre><code>    stream = open('file.yml', 'r')
      dict = yaml.safe_load(stream)
  </code></pre>
  
  <p>But what I think I need is something like:</p>
  
  <pre><code>    stream = open('file.yml', 'r')
      temp_string = stringFromString(stream)     #convert stream to string
      temp_string.replace('%', '_PLACEHOLDER_')  #replace with place holder
      stream = streamFromString(temp_String)     #conver back to stream
      dict = yaml.safe_load(stream)
  </code></pre>