Quantcast
Channel: Python Hispano
Viewing all articles
Browse latest Browse all 180

python majibu: Iterar sobre lista de n nivel?

$
0
0

Tengo este codigo y el resultado subsiguiente, tengo un problema, no entiendo como iterar sobre cada elemento de cada bloque.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
n=30izq=nder=n+1blocksize=n+2pos=0hashblock=[None]*blocksizeforiinrange(n):pos+=1hashblock[i]=abs(hash(i))ifpos==n:pos=0newblock=[None]*blocksizehashblock[der]=newblocknewblock[izq]=hashblockhashblock=newblock#>>> hashblock#[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, None, [...]], [...]], [...]], None]

Viewing all articles
Browse latest Browse all 180