Python - Multiple array into another array -


basically have no idea how this.

but if have multiple array:

[[1, 2], [3, 4]

which can seen as:

([[x, y], [x, y]...])

and want create new array x, separated 4 sectors:

(1, 2, 3, 4) array_(number(y)) = [x, 0, 0, 0]   

if f.e x = 1 , y = 2 should this:

array_2 = [0, x, 0, 0]

i'm sorry not posting code begin with, literally have 0 ideas.
can me come something?

you can achive using itertools:

import itertools xyarray = [[1,2],[3,4]] xarray = list(itertools.chain(*xyarray)) 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -