mysql.connector.errors.ProgrammingError:1054(42S22):'where子句'中的未知列'PY_VAR0'

I'm trying to make a tkinter app(real quick) that actually draws search results from my database but, i want the user to specify the column name so i use a dropdown and then they can choose from the dropdown but wen i use that variable in the database command, it returns error mysql.connector.errors.ProgrammingError: 1054 (42S22): Unknown column 'PY_VAR0' in 'where clause'. Thanks in advance :)

码:

from tkinter import *
import mysql.connector as mysql
import datetime

root = Tk()

def db():
    con = mysql.connect(host='localhost', user='root', password='monkey123', database='BOOK')
    c = con.cursor()
    c.execute(f"SELECT * from lessc where `{g}` like '{e1.get()}%';")

    rec = c.fetchall()

    print_record = ""
    for recs in rec:
        print_record += 'BOOK: ' + str(recs[1]) + '\t' + ' Author: ' + str(recs[2]) + "\n"

    query_label = Label(root,text=print_record)
    query_label.pack()
    c.execute('commit')
    con.close()
    e1.delete(0,END)

l1 = Label(root,text='Book name')
l1.pack()

e1 = Entry(root)
e1.pack()

b1 = Button(root,text='Search',command=db)
b1.pack()

b2 = Button(root,text='Exit',command=root.destroy)
b2.pack()

gen = ['Sl.no.','Title of the book','Authors','Editors','Revised by','Edition','Accession no.','Call no.','Item','Subject','Year','ISBN','Publisher','Updated on','Price','Supplier']
g = StringVar()
g.set('Choose Search method')
opt_g = OptionMenu(root,g,*gen)
opt_g.pack()

root.mainloop()