pyt...@bdurham.com ha scritto:
Terry,

 ... word[0:1] does the same thing. All Python programmers should learn to use 
slicing to extract a char from a string that might be empty.

Is there an equivalent way to slice the last char from a string (similar
to an .endswith) that doesn't raise an exception when a string is empty?


could it be:

word[len(word)-1:] ?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to