import mysql.connector

cnx = mysql.connector.connect(user='root', password='',
                              host='127.0.0.1',
                              database='dbpython')

select_sql="Select * From Persons"
insert_sql="insert into Persons (FirstName,LastName) VALUES ('%s','%s')"%('Homayoon','Hasanzadeh')

cr = cnx.cursor()

cr.execute(insert_sql)

cr.execute(select_sql)

for id,FirstName,LastName in cr.fetchall():
    print(FirstName,LastName)

cnx.commit()

cr.close()
cnx.close