How do I add Gurobi constraints and variables from lists of strings in an automated way?

Here is a concise answer to your question but please keep in mind that this is very unsafe and error-prone and should never be used in actual code:

import gurobipy as gp

m = gp.Model()
variables = ["y1", "y2", "y3", "y4", "y5", "y6", "y7"]
constraints = ["y1+3*y2-y3>=2", "y4+y5+y6+y7==2"]

for v in variables:
    exec(f"{v} = m.addVar(name = '{v}')")

for c in constraints:
    exec(f"m.addConstr({c})")

m.write("out.lp")

out.lp:

Minimize
 
Subject To
 R0: y1 + 3 y2 - y3 >= 2
 R1: y4 + y5 + y6 + y7 = 2
Bounds
End

Similar questions have been asked multiple times on SO (e.g. here and in the linked duplicates) and the best way to work with "strings as variable names" simply is a dictionary.

Using addVars() is the correct way of creating the set of variables according to your specified list of names:

v = m.addVars(variables)
m.update()
print(v)

output:

{'y1': <gurobi.Var C0>, 'y2': <gurobi.Var C1>, 'y3': <gurobi.Var C2>, 
 'y4': <gurobi.Var C3>, 'y5': <gurobi.Var C4>, 'y6': <gurobi.Var C5>,
 'y7': <gurobi.Var C6>
}

This is not possible for the list constraints, though.