I'd like to check if there's "@" in a string and wondering if any method
is better/safer than others. I was told on one occasion that I should
use is than ==, so how would be on this example.

s = 't...@mail.is'

I want check if string is a valid email address.

code '''
import time

email = "t...@mail.tu"

start_time = time.time()
for i in range(len(email)):
  print('@' in email[i])

print ("My program took", time.time() - start_time, "to run")


print('----------')
start_time = time.time()
for i in range(len(email)):
    print(email[i] == '@')

print ("My program took", time.time() - start_time, "to run")
print('----------')
start_time = time.time()
if '@' in email:
    print('True')

print ("My program took", time.time() - start_time, "to run")

'''
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to