Search code examples
pythonarrayssplitintseparator

Splitting Python Integer(blender3d)


This sounds very simple but is it possible to split an integer like lets say 8 to an array like this [0,1,2,3,4,5,6,7,8] i have already tried the code below

proxies= 'a,b,c,d,e,f,g,h'#list of objects to attach the expression to 
objlist = proxies.split(",")#splits every word as an object wherever theres a comma ,

ofset = (len(objlist))

ofset comes out as 8. but i want ofset to be an array of [0,1,2,3,4,5,6,7,8].


Solution

  • change :

    ofset = (len(objlist))
    

    to :

    ofset = range(len(objlist)+1)