1. Cú pháp [start:stop:step]
print("So have we spun"[0::3])=Sheep
Lấy ký tự đầu và ký tự thứ 3 của mỗi chuỗi 3 ký tự
print('catastrophe'[0:3])=cat
print("The Dogs of War"[4:7])=dog
print("The Trouble with Lichen"[-3:])=hen
print("Springy"[1::2])=pig
print("meagre"[-2::-2])=ram
Nhận xét
Đăng nhận xét