title: Python Input Sanitization
body: <p>I need to do some very quick-n-dirty input sanitizing and I would like to basically convert all <code>&lt;, &gt;</code> to <code>&amp;lt;, &amp;gt;</code>.  </p>
  
  <p>I'd like to achieve the same results as <code>'&lt;script&gt;&lt;/script&gt;'.replace('&lt;', '&amp;lt;').replace('&gt;', '&amp;gt;')</code> without having to iterate the string multiple times.  I know about <code>maketrans</code> in conjunction with <code>str.translate</code> (ie. <a href="http://www.tutorialspoint.com/python/string_translate.htm" rel="noreferrer">http://www.tutorialspoint.com/python/string_translate.htm</a>) but this only converts from 1 char to another char.  In other words, one cannot do something like:</p>
  
  <pre><code>inList = '&lt;&gt;'
  outList = ['&amp;lt;', '&amp;gt;']
  transform = maketrans(inList, outList)
  </code></pre>
  
  <p>Is there a <code>builtin</code> function that can do this conversion in a single iteration?</p>
  
  <p>I'd like to use <code>builtin</code> capabilities as opposed to external modules.  I already know about <code>Bleach</code>.</p>