I'd like to be able to pull users from a database using either a supplied e-mail address or the user id (an integer). To do this, I have to detect if the supplied string is an integer, or an e-mail. Looking for the fastest way to do this. Thanks.
def __init__(self, data):
#populate class data
self._fetchInfo(data)
def _fetchInfo(self, data):
#If an email
#SELECT ... WHERE email = 'data'
#or if a user_id
#SELECT ... WHERE id = 'data'
#Fill class attributes
self._id = row['id']
self._email = row['id']
...