T
T
The_Neo2017-08-10 00:55:21
Python
The_Neo, 2017-08-10 00:55:21

How to generate a list of arrays by iterating?

The bottom line: there is an array of elements. You need to output them to a file as a list of arrays of 5 elements:
mass = ['1','2','3','4','5','6','7','8']

['1','1','1','1','1']
['1','1','1','1','2']
['1','1','1','1','3']
...
['1','1','1','2','1']
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2017-08-10
@The_Neo

from itertools import product

for e in product([1, 2, 3], repeat=2):
    print(e)

change the data to your own, output even to a file, even into space.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question