A substring can be extracted from a string with brackets. The characters are zero-indexed, so text[n] gets the character at position n+1.
The optional second number (after the colon) is exclusively, so text[n:m] gets the characters at position n+1 through m.
If the numbers are negative, they count from the end of the string towards the beginning.
#!/usr/bin/python3
txt = '0123456789'
print(txt[ 3 ]) # 4th character - 3
print(txt[ 3:7]) # From 4th to 7th character - 3456
print(txt[ 7: ]) # From 8th character to end - 789
print(txt[-2 ]) # 2nd last character - 8
print(txt[-4: ]) # 4th last character to end - 6789