def sliceFromString(sliceString):
 sliceArgs = []
 for val in sliceString.split(':'):
  if (len(val) == 0):
   sliceArgs.append(None)
  else:
   sliceArgs.append(int(round(float(val))))
 return apply(slice, sliceArgs)

def sliceFromString ( sliceString ) : sliceArgs = [ ] for val in sliceString . split ( ':' ) : if ( len ( val ) == 0 ) : sliceArgs . append ( None ) else : sliceArgs . append ( int ( round ( float ( val ) ) ) ) return apply ( slice , sliceArgs )
convert a text string into a valid slice object which can be used as indices for a list or array .