i wonder if i can change string to var

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By potatobanana

i wonder if i can change this kind string to var ,
"apple = 10" to apple = 10

of course i will make var apple first

reason, i wonder if can take item description in my dictionary, and use it for var/statement and label at same time.

:bust_in_silhouette: Reply From: Inces

It is not really possible, since apple = 10 is not a variable, it is whole piece of code :slight_smile:
But by some complicated string operations You actually can do it, I don’t think it is worth it.
It would be easier to do it other way : convert variable from dictionary into string for description.
It would go like this :
var fruits = {apple:10, banana : 25, grape : 12 }

for x in fruits.keys() :
var descriptiontext = x + " = " + str(fruits)