How to preallocate a list in Python 3.4? -


i want create list of 100 elements. how do in python 3.4. tried following.

l = none * [100] 

but got following error

typeerror: can't multiply sequence non-int of type 'nonetype' 

it works in python 2.x not python 3.4.

i tried l = range[100], won't allow me modify elements afterwards.

you thinking of l = [none] * 100. ּּּּl = none * [100]ּ not valid in python 2.x nor python 3.x.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -