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-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 4 items of a list?
 
 Did you try the same get the last 4 items solution that worked
 for a string?
 
lst[-4:]


The idea was to ask a question that would help the original poster to
answer their own question.  =)



*

The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential, proprietary, and/or privileged 
material. Any review, retransmission, dissemination or other use of, or taking 
of any action in reliance upon this information by persons or entities other 
than the intended recipient is prohibited. If you received this in error, 
please contact the sender and delete the material from all computers. GA621


-- 
http://mail.python.org/mailman/listinfo/python-list


Last 4 Letters of String

2008-02-21 Thread Robert Rawlins - Think Blue
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.

 

Any ideas?

 

Rob

-- 
http://mail.python.org/mailman/listinfo/python-list

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.diveintopython.org/native_data_types/lists.html

 
  
 
 Any ideas?
 
  
 
 Rob
 
 
 

-- 
http://mail.python.org/mailman/listinfo/python-list


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.



 Any ideas?



 Rob
 --
  http://mail.python.org/mailman/listinfo/python-list



-- 
Rafael Sachetto Oliveira

Sir - Simple Image Resizer
http://rsachetto.googlepages.com
-- 
http://mail.python.org/mailman/listinfo/python-list


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 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.

 

Any ideas?

 

Rob

-- 
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'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.

 

Any ideas?

 

Rob

-- 
http://mail.python.org/mailman/listinfo/python-list