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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -