• "macrovariable" in Python

 

Hi everybody. I'm learning Python with checkio and in parallel, I try to develop something for my firm. In this development, I have a list with numbers [602, 301, ...], and I would like to put, in a other list, a col of a dataframe whose name is "top_" suffixed by a number of the first list. I did that :

   title=dataframe2['titleid']     #my number list
   for t in title:
      var="\'top_"+str(t)+"\'"
      print(var)
      col=dataframe1[var]
      print(col)

But col=dataframe1[var] is not ok, because he doesn't know the column "var"

Can you help me? Thanks

.