Slice by Position in Python
If you want to create a slice from a position, only the starting index is specified before the colon. Let's print the characters of the string starting at index 2:
txt = 'abcde'
res = txt[2:]
print(res) # 'cde'
Given a string:
txt = '12345'
Get a slice of all its characters except the first one:
'2345'
Given a list:
lst = ['ab', 1, 'cd', 2, 'ef', 3, 4]
Get the following slice of its elements:
[2, 'ef', 3, 4]