Rodrigo Girão Serrão 🐍🚀 @mathspp.com · Nov 20

Here's how to NOT get a file name from a path in Python. The string method `split` has a counterpart `rsplit` that starts splitting from the end of the string. This is useful if you only want the final segment(s) of a string.

2 likes 1 replies

?

Replies

Rodrigo Girão Serrão 🐍🚀 · Nov 20

If you split without restrictions, they behave the same way: ```py >>> "This is bananas".split() ['This', 'is', 'bananas'] >>> "This is bananas".rsplit() ['This', 'is', 'bananas'] ``` So, what's the point..?