Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

superpollo utente at esempio.net
Tue May 11 12:39:42 EDT 2010


James Mills ha scritto:
> 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:]

d'uh. ;-)



More information about the Python-list mailing list