title: Python - Remove Square symbol from text string
body: <pre><code>a='ÿþ"[]B[]a[]l[]a[]n[]c[]e'
  </code></pre>
  
  <p>NOTE: The open and close square brackets represent this square symbol.  I cannot however copy and paste the square symbol into here to show you exactly what I'm looking at.</p>
  
  <p>The characters in 'a' represent the beginning of a file I've downloaded.  It is a csv file, unicode.  How do I remove these unwanted characters?  I would just like to recover the word 'balance' from a.</p>
  
  <p>The code I've used to simply this example:</p>
  
  <pre><code>fi = open(path+fn, 'r')
  data = fi.read()
  fi.close()
  print(data)
  </code></pre>
  
  <p>Where <code>fn</code> is a csv file.</p>
  
  <p>Tried:</p>
  
  <pre><code>data=data.encode()
  d=replace('\x00','')
  </code></pre>
  
  <p>which produced error:</p>
  
  <pre><code>TypeError: expected bytes, bytearray or buffer compatible object
  </code></pre>