I would like to use a string as a part of the variable in a loop like this:
items = ['apple', 'tomato']
for item in items:
'eat_'+item = open("users/me/"+item+"/file.txt").read()
So that as an output I have 2 variables named eat_apple and eat_tomato.
Obviously, the 'eat_'+item is wrong but to just get my idea.
P.S. I saw similar posts but neither of them helped
eat_to a variable, and use it inside the loop.x = 'eat_'and then sayx+item = open("users/me/"+item+"/file.txt").read(), this doesn't helpitem = pen("users/me/"+item+"/file.txt").read(). Then,item = 'eat_' + itemeat_part is added to the string itself, not the variable name