title: How to filter out unicode characters in Python?
body: <p>I am working on unicode values in python for sometime now. Firstly, all the questions and answers help alot. Thanks :)</p>
  
  <p>Next, I am stuck in my project where I want to isolate the unicode values for each language.</p>
  
  <p>Like, a certain function only accepts hindi codes which are from unicode values 0900 to 097F. Now I want it to reject the rest of all the unicode values...</p>
  
  <p>I have , as of now, done</p>
  
  <pre><code>for i in range(len(l1)):
      for j in range(len(l1[i])):
          unn = '%04x' % ord(l1[i][j])
          unn1 = int(unn, 16)
          if unn1 not in range(2304, 2431):
              l1[i] = l1[i].replace(l1[i][j], '')
  </code></pre>
  
  <p>this code takes in the values from a list l1 and does what I want it to. But there problem is that it solves for one character and then it terminates at line 3</p>
  
  <p>On manually running it again, it runs and again solves one or two characters and then terminates again.</p>
  
  <p>I cant even put it inside a loop....</p>
  
  <p>Please help</p>
  
  <hr>
  
  <p>Updated:</p>
  
  <p>I didnt wanna put another post so using this one only
  I got some help and modified the code. There is index problem.</p>
  
  <pre><code>for i in range(len(dictt)):
      j=0
      while(1):
          if j &gt;= len(dictt[i]):
              break
          unn = '%04x' % ord(dictt[i][j])
          unn1 = int(unn, 16)
          j = j+1
          if unn1 not in range(2304, 2431):
              dictt[i] = dictt[i].replace(dictt[i][j-1], '')
              j=0
  </code></pre>
  
  <p>this code works perfectly fine for my previous query I meant for a specific range but if I change the range or the functionality then again the same problem arises at the same line.
  Why is that line giving error??</p>