title: Replace some special chracters from email in django
body: <p>I want to replace special characters from email in django. I have Google this issue and found stack question which is very helpful <a href="https://stackoverflow.com/questions/14747459/remove-special-chracters-from-a-string-in-django">question</a>. </p>
  
  <p>But there are some issues with this. If i tried this </p>
  
  <pre><code>a='testemail@email.com'
      replace=['@','.']
      for i in replace:
          a=a.replace(i,'_')
  </code></pre>
  
  <p>or this</p>
  
  <pre><code>u_name=re.sub(r'[^a-zA-Z0-9]', '_', str(email))
  </code></pre>
  
  <p>and in template </p>
  
  <pre><code>{% for i in u_name%}
  {{i}}&lt;br&gt;
  {% endfor %}
  </code></pre>
  
  <p>it will return </p>
  
  <pre><code>t
  e
  s
  t
  e
  m
  a
  i
  l
  _
  e
  m
  a
  i
  l
  _
  c
  o
  m
  </code></pre>
  
  <p>but i want like this <code>testemail_email_com</code> so that i can store it in DB with the help of loop but it store only first characters.</p>
  
  <p>So please tell me how i can do this.</p>
  
  <p>Thanks</p>
  
  <p>I am migrating some data from other DB and wanted to store it into django db. Let say i have data for 1o users , the emails of these users store into following array. Now i wanted to replace special characters from these email so that i can use them as username.</p>
  
  <p><strong>Edited :</strong></p>
  
  <pre><code>email.append(row[i][1]) 
  </code></pre>