-3

I have several lists: values1, values2, values3.

Now I want to do some operations in a loop. I was looking for an easy solution without using dictionaries to do something like this:

values1 = []
values2 = []
values3 = []

for i in numpy.arange(1, 3):
    items = values+str(i)
    ...
    ...

Is there a quick an easy way to do this?

Thanks in advance.

lrsp
  • 1,213
  • 10
  • 18
  • 1
    Take a look at [this](http://stackoverflow.com/questions/252703/append-vs-extend) – Thomas Blanquet Nov 28 '16 at 09:54
  • 4
    What's wrong with doing `for items in (values1, values2, values3):`? BTW, you should give those lists more meaningful names. Using a series of numbered names is an anti-pattern, and generally indicates that the objects in question should be in a list or tuple. – PM 2Ring Nov 28 '16 at 10:06
  • Didnt think about that. Thank you very much! – lrsp Nov 28 '16 at 17:49

1 Answers1

1

You could try:

values1 = []
values2 = []
values3 = []

for values in [values1, values2, values3]:
    ...
Colo
  • 26
  • 1