Python string slicing ✂️

Published: 21 December 2020
on channel: Bro Code
76,132
3.7k

Python string slice tutorial example explained

#python #slice() #slicing

slicing = create a substring by extracting elements from another string
indexing[] or slice()
[start:stop:step]

name = "Bro Code"

first_name = name[:3] # [0:3]
last_name = name[4:] # [4:end]
funky_name = name[::2] # [0:end:2]
reversed_name = name[::-1] # [0:end:-1]

print(reversed_name)

website1 = "http://google.com"
website2 = "http://wikipedia.com"

slice = slice(7,-4)

print(website1[slice])
print(website2[slice])

––––––––––––––––––––––––––––––
Up In My Jam (All Of A Sudden) by - Kubbi   / kubbi  
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
Free Download / Stream: http://bit.ly/2JnDfCE
Music promoted by Audio Library    • Up In My Jam (All Of A Sudden) – Kubbi (No...  
––––––––––––––––––––––––––––––


On this page of the site you can watch the video online Python string slicing ✂️ with a duration of hours minute second in good quality, which was uploaded by the user Bro Code 21 December 2020, share the link with friends and acquaintances, this video has already been watched 76,132 times on youtube and it was liked by 3.7 thousand viewers. Enjoy your viewing!