RE: Last 4 Letters of String

2008-02-25 Thread Reedick, Andrew
> -Original Message- > From: Tim Chase [mailto:[EMAIL PROTECTED] > Sent: Monday, February 25, 2008 8:34 AM > To: Reedick, Andrew > Cc: Robert Rawlins - Think Blue; python-list@python.org > Subject: Re: Last 4 Letters of String > > > How would you get the last

Re: Last 4 Letters of String

2008-02-25 Thread Tim Chase
> How would you get the last 4 items of a list? Did you try the same "get the last 4 items" solution that worked for a string? lst[-4:] -tkc -- http://mail.python.org/mailman/listinfo/python-list

RE: Last 4 Letters of String

2008-02-21 Thread James Newton
>>> "string whose last four letters are abcd"[-4:] 'abcd' From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: 21 February 2008 11:36 To: python-list@python.org Subject: Last 4 Letters of String Hello Guys, I

Re: Last 4 Letters of String

2008-02-21 Thread Rafael Sachetto
Try this >>> s = "abcdefgh" >>> s[-4:] 'efgh 2008/2/21, Robert Rawlins - Think Blue <[EMAIL PROTECTED]>: > > > > > Hello Guys, > > > > I'm looking for a function which will give me the last 4 characters of a > given string. I'm sure it's a very simple task but I couldn't find anything > of it. >

Re: Last 4 Letters of String

2008-02-21 Thread Michael L Torrie
Robert Rawlins - Think Blue wrote: > Hello Guys, > > > > I'm looking for a function which will give me the last 4 characters of a > given string. I'm sure it's a very simple task but I couldn't find anything > of it. Use the same technique as you'd use slicing a list. http://www.diveintopytho

RE: Last 4 Letters of String

2008-02-21 Thread Reedick, Andrew
How would you get the last 4 items of a list? From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: Thursday, February 21, 2008 11:36 AM To: python-list@python.org Subject: Last 4 Letters of String Hello Guys, I'm looking for a function whic