python - Why does the following code snippet returns None? -


this should append values in list val new list creating here using range method.

val = [1, 2, 3,'time is', 10, 'up'] print val.extend(range(0,10)) 

list.extend() extends list object in place , returns none.

you can print val after extending:

val.extend(range(0,10)) print val 

or use concatenation:

print val + range(0, 10) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -