Idiom for "last word in a string"
invalid at invalid.invalid
Wed Sep 23 20:47:05 CEST 2009
I recently ran across this construct for grabbing the last
(whitespace delimited) word in a string:
It was somewhat obvious from the context what it was supposed
to do, but it took a bit of Googling to figure out exactly what
was going on.
When I want the last word in a string, I've always done this:
I was wondering what the advantage of the rsplit(None,1)
approach would be other than inducing people to learn about the
maxsplit argument that is accepted by the split() methods?
Grant Edwards grante Yow! I want a VEGETARIAN
at BURRITO to go ... with
visi.com EXTRA MSG!!
More information about the Python-list