Q:

Write a Python program to get the last part of a string before a specified character.

0

Write a Python program to get the last part of a string before a specified character. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

str1 = 'https://www.w3resource.com/python-exercises/string'
print(str1.rsplit('/', 1)[0])
print(str1.rsplit('-', 1)[0])

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now