Grant Edwards wrote:
I recently ran across this construct for grabbing the last
(whitespace delimited) word in a string:
s.rsplit(None,1)[1]
... I've always done this:
s.split()[-1]
I was wondering what the advantage of the rsplit(None,1)[1]
approach would be ...
Others have pointed out th
akonsu wrote:
> On Sep 23, 2:47 pm, Grant Edwards wrote:
>> I recently ran across this construct for grabbing the last
>> (whitespace delimited) word in a string:
>>
>> s.rsplit(None,1)[1]
>>
>> It was somewhat obvious from the context what it was supposed
>> to do, but it took a bit of Googling
At Wed, 23 Sep 2009 18:47:05 + (UTC),
Grant Edwards wrote:
>
> I recently ran across this construct for grabbing the last
> (whitespace delimited) word in a string:
>
>s.rsplit(None,1)[1]
>
> It was somewhat obvious from the context what it was supposed
> to do, but it took a bit of Googlin
At Wed, 23 Sep 2009 18:47:05 + (UTC),
Grant Edwards wrote:
>
> I recently ran across this construct for grabbing the last
> (whitespace delimited) word in a string:
>
>s.rsplit(None,1)[1]
>
> It was somewhat obvious from the context what it was supposed
> to do, but it took a bit of Goog
At Wed, 23 Sep 2009 18:47:05 + (UTC),
Grant Edwards wrote:
>
> I recently ran across this construct for grabbing the last
> (whitespace delimited) word in a string:
>
>s.rsplit(None,1)[1]
>
> It was somewhat obvious from the context what it was supposed
> to do, but it took a bit of Goog
At Wed, 23 Sep 2009 18:47:05 + (UTC),
Grant Edwards wrote:
>
> I recently ran across this construct for grabbing the last
> (whitespace delimited) word in a string:
>
>s.rsplit(None,1)[1]
>
> It was somewhat obvious from the context what it was supposed
> to do, but it took a bit of Goog
On Sep 23, 2:47 pm, Grant Edwards wrote:
> I recently ran across this construct for grabbing the last
> (whitespace delimited) word in a string:
>
> s.rsplit(None,1)[1]
>
> It was somewhat obvious from the context what it was supposed
> to do, but it took a bit of Googling to figure out exactly
I recently ran across this construct for grabbing the last
(whitespace delimited) word in a string:
s.rsplit(None,1)[1]
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 st