If is None in python

169 Views Asked by At

I am new to python and getting a syntax error with my first program. Can you please help correct the syntax?

GET_CONTACT = "SELECT LINKEDIN_URL, CONTACT_ID from PERSON where LINKEDIN_URL=%s"

def isContactExists(linkedinUrl):
    cur.execute(GET_CONTACT, (linkedinUrl, ))
    return cur.fetchone()

if existing_contact is not None:
        storeInTempTable(record)
    return

Throws syntax error -

storeInTempTable(record)
                       ^
TabError: inconsistent use of tabs and spaces in indentation
1

There are 1 best solutions below

0
Binit Amin On

You are having spaces and TAB both into your code. Don't mix space and TAB.

GET_CONTACT = "SELECT LINKEDIN_URL, CONTACT_ID from PERSON where LINKEDIN_URL=%s"

def isContactExists(linkedinUrl):
    cur.execute(GET_CONTACT, (linkedinUrl, ))
    return cur.fetchone()

if existing_contact is not None:
    storeInTempTable(record)
    return