Getting last char in string.

James Kew james.kew at btinternet.com
Thu Sep 26 04:00:21 EDT 2002


"CheapSkate" <gua81 at XXXyahoo.com> wrote in message
news:amue3q$h59$1 at lust.ihug.co.nz...
> Hi, im writing a simple method that takes in a string input and check if
the
> last charcter is an '/'
> then it will do A else do B
>
> my Q now is how to get the last char???

if stuff[-1:] == '/':

or

if stuff.endswith('/'):

--
James Kew
james.kew at btinternet.com






More information about the Python-list mailing list