Python: Appending items to a list -


i want append few items within loop lists. doing is,

lista = [] listb = [] listc = [] in range(0,100):     lista.append(i) j in range(0,100):     listb.append(j) 

and on. there smarter way that?

the simple way achieve is:

lista = range(100) listb = range(100) listc = range(100) 

or

lista, listb, listc = [range(100) _ in range(3)] 

hope helps.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -