import re
regexStr = r'^([^@]+)@[^@]+$'
emailStr = 'shubhamnath5@gmail.com'
username = re.search(regexStr, emailStr)
print(username.group(1))
#or
emailStr = 'shubhamnath5@gmail.com'
emailStr.split("@")[0]
import re
regexStr = r'^([^@]+)@[^@]+$'
emailStr = 'shubhamnath5@gmail.com'
username = re.search(regexStr, emailStr)
print(username.group(1))
#or
emailStr = 'shubhamnath5@gmail.com'
emailStr.split("@")[0]