Slices
str[i1:i2] - substring from i1 to i2. i2 is excluded
str[idx] - one character substring at 'idx'.
this is equivalent to str[idx:idx+1]
str[:idx] - substring from the beginning of the string to idx
this is equivalent to str[0:idx]
str[idx:] - substring from idx to the end of the string
this is equivalent to str[idx:0x7fffffff] str[0:2] = "abc"; auto x = object();
x[0] = value1;
x[1] = "value2";Last updated
Was this helpful?
