RosettaCodeData/Task/Substring-Top-and-tail/Python/substring-top-and-tail-1.py

4 lines
155 B
Python

print "knight"[1:] # strip first character
print "socks"[:-1] # strip last character
print "brooms"[1:-1] # strip both first and last characters