Prev: urllib.urlopen blocking?
Next: Slice last char from string without raising exception on emptystring (Re: Extract all words that begin with x)
From: python on 11 May 2010 10:37 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? Thanks, Malcolm |