Hi I have a python code written as followed. Can someone please explain what these colons do?
edges = (data[0,0:-1]+data[0,1])/2.0
counts = data[1,1:]
Hi I have a python code written as followed. Can someone please explain what these colons do?
edges = (data[0,0:-1]+data[0,1])/2.0
counts = data[1,1:]
Taken from https://stackoverflow.com/users/482864/soulseekah
: is the delimiter of the slice syntax to 'slice out' sub-parts in sequences , [start:end]
[1:5] is equivalent to "from 1 to 5" (5 not included)
[1:] is equivalent to "1 to end"
[len(a):] is equivalent to "from length of a to end"
Retried from Colon (:) in Python list index