6.2.3 Slicing stringsSegments of strings can be cut out by using square brackets to slice the string: pyxplot> poem = "On the last sabbath day of 1879n" If a single number is placed in the square brackets, a single character is taken out of the string. If two colon-separated numbers are specified, [x:y], then the substring from character position x up to but not including y is returned. If either x or y are omitted, then the start or end of the string is used respectively. If either number of negative, then it counts from the end of the string, being the last character in the string.
|