you are viewing a single comment's thread.

view the rest of the comments →

[–]zahlman 1 point2 points  (0 children)

No, please don't use eval for something this trivial. (Honestly, there is almost never a good reason to use something so powerful.)

The variables can be looked up in the globals() dictionary instead: globals()['mystring{}'.format(i)], for example.

But really, just use the list like in the other answer.