In [1]:
s = '0123456789'
In [2]:
print(s[3:7])
In [3]:
print(s[3:-3])
In [4]:
print(s[:5])
In [5]:
print(s[5:])
In [6]:
print(s[:3] + s[6:])
In [7]:
def remove_str_start_end(s, start, end):
return s[:start] + s[end + 1:]
In [8]:
print(remove_str_start_end(s, 3, 5))
In [9]:
def remove_str_start_length(s, start, length):
return s[:start] + s[start + length:]
In [10]:
print(remove_str_start_length(s, 3, 5))