I want to replace special characters from email in django. I have Google this issue and found stack question which is very helpful question.
But there are some issues with this. If i tried this
a='testemail@email.com'
replace=['@','.']
for i in replace:
a=a.replace(i,'_')
or this
u_name=re.sub(r'[^a-zA-Z0-9]', '_', str(email))
and in template
{% for i in u_name%}
{{i}}<br>
{% endfor %}
it will return
t
e
s
t
e
m
a
i
l
_
e
m
a
i
l
_
c
o
m
but i want like this testemail_email_com
so that i can store it in DB with the help of loop but it store only first characters.
So please tell me how i can do this.
Thanks
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.
Edited :
email.append(row[i][1])