-2

I'm trying to get a string as a variable to represent my column in DB.

l_id =1
level=7
test = "level"+level
device_level_mapping = DeviceLevelMapping.objects.filter(test = l_id)

It says keyword cant be an expression.

I need to do something like this. In PHP we do like this.

$a = "test"+"1";
$$a = 10;
echo $test1; // now test1 has become a variable.

How do I make this happen in python?

4

1 に答える 1