"Bryan Fodness" <[EMAIL PROTECTED]> wrote

but I would like to change b to look like this,

[[0 0 0 0 0 0 0 0 0]
[0 0 3 3 3 3 3 0 0]
[0 0 3 3 3 3 3 0 0]

My data will not be regular like these. I have a 400x60 array with
irregular data that I would like as a 400x400 array.

I'm not quite sure the significance of the last bit but it looks like
you just want to pad equally on both sides with zeros?

N = (400-60)/2   # = 70
padded = [[0]*N + row + [0]*N for row in oldarray]

Untried and maybe not too fast but simple.

Or am I missing a complication?

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to