Index counting from the last char

gisleyt gisleyt at gmail.com
Mon May 22 03:33:45 EDT 2006


I'd like to use the index-function to retrieve a certain char in a
string, but i need it to start counting from the last char.

E.g. in the string.

Foo-bar, foo foo-bar

I want the latter hyphen to be returned when i do a index for '-'. Is
there any built in function for this, I don't want to reverse every
string just to do this.

-Gisle-




More information about the Python-list mailing list