Error 000358means "The SQL expression is invalid", as described in Help - ArcGIS Desktop
Your query, "Id=k", means that "get Idand k (field) value of a feature, compare both, if both are equal, select that feature". Since there is no kfield in poligon layer, you encounter an error. Even if k existed as a field, any feature whose Id and kfield are equal would be selected.
But you want to select all features meet Id=2. So, you have to concatenate "Id="string and integer k for where clause.
You can do it in different ways:
k = 2
m = 3
"Id=" + str(k) #1 "Id=2"
"Id=%s" %k #2 "Id=2" old style
"Id={}".format(k) #3 "Id=2" new style
"Id={0}".format(k) # by index
## multiple variables ##
"Id=%s%s" %(k, m) # "Id=23"
"Id={}{}".format(k, m) # "Id=23"
# by index, m->0, k->1
"Id={1}{0}_{1}{1}".format(m, k) "Id=23_22"
"Id=" + k # doesn't work. In Python, you cannot concatenate string
# and integer in that way unlike some languages do.
"Id=" + str(k)as where_clause. Or this link can help. – Kadir Şahbaz Apr 08 '18 at 21:26"Id={}".format(k)I like that because it is so easily modified when using text fields to"Id='{}'".format(k). I also agree wholeheartedly "that getting some exposure to format statements may benefit you as you move to more complex statements". – PolyGeo Apr 08 '18 at 22:45