import re

email = "firstname.lastname@gmail.com";
m = re.match(r'^([^\s@.]+)\.([^\s@.]+)@([^\s@]+)$', email)
if m:
    print(m.groups())
