what is python [:-1] code example
Example 1: python [:-1]
data.append(line[:-1])
#slices the line until last element (\n for example)
Example 2: in python [:-1]
>>> L = range(10)
>>> L[::2]
[0, 2, 4, 6, 8]
data.append(line[:-1])
#slices the line until last element (\n for example)
>>> L = range(10)
>>> L[::2]
[0, 2, 4, 6, 8]