Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)
James Mills
prologic at shortcircuit.net.au
Tue May 11 12:35:36 EDT 2010
On Wed, May 12, 2010 at 2:01 AM, <python at bdurham.com> wrote:
>> word[len(word)-1:]
This works just as well:
>>> word[-1:]
cheers
James
More information about the Python-list
mailing list