title: Best way to replace \x00 in list of strings?
body: <p>I have a list of values from a parsed PE file that include <code>\x00</code> null bytes at the end of each section.  I want to be able to remove the <code>\x00</code> bytes from the string without removing all <code>&quot;x&quot;</code>s from the file.  I have tried doing <code>.replace()</code> and <code>re.sub()</code>, but not with much success.</p>
  <p>Using Python 2.6.6</p>
  <p>Example.</p>
  <pre><code>import re
  
  List = [['.text\x00\x00\x00'], ['.data\x00\x00\x00'], ['.rsrc\x00\x00\x00']]
  
  count = 0
  while count &lt; len(List):
      test = re.sub('\\\\x00', '', str(List[count]))
      print test
      count += 1
  </code></pre>
  <p>Output:</p>
  <pre class="lang-none prettyprint-override"><code>['.text']
  ['.data']
  ['.rsrc']
  </code></pre>
  <p>I want to get the following output:</p>
  <pre class="lang-none prettyprint-override"><code>.text
  .data
  .rsrc
  </code></pre>
  <p>Any ideas on the best way of going about this?</p>