Python 3 slice string from a last certain character

target=url.split("/")[-1]

split methode returns a list of words separated by the separator specified in the argument and [-1] is for the last element of that list

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top