Slicing-Operator

für alle Sequenz-Datentypen: String, Liste, Tuple

name = 'Friedrich Rückert'
name[:9]
'Friedrich'
print(name[0:4])
print(name[:-3])
print(name[-3:])
print(name[3:5])
Frie
Friedrich Rück
ert
ed
L2 = ['Das', 'tapfere', 'Schneiderlein', 'traf', 7, 'auf', 'einen', 'Streich']

print(L2[0:4])
print(L2[:-3])
print(L2[-3:])
print(L2[3:5])
['Das', 'tapfere', 'Schneiderlein', 'traf']
['Das', 'tapfere', 'Schneiderlein', 'traf', 7]
['auf', 'einen', 'Streich']
['traf', 7]