Re: how to truncate to get the 1st 5 chars from a string

2009-09-23 Thread Grant Edwards
On 2009-09-24, MacRules wrote: > s="1234abcd" > s.range(0..4) > 1234a > > Is there a string function like this? http://www.google.com/search?q=python+tutorial -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: how to truncate to get the 1st 5 chars from a string

2009-09-23 Thread Donn
On Thursday 24 September 2009 05:05:45 MacRules wrote: > s="1234abcd" print s[0:4] should do it. Not sure it's a function though. \d -- home: http://otherwise.relics.co.za/ 2D vector animation : https://savannah.nongnu.org/projects/things/ Font manager : https://savannah.nongnu.org/projects/fon

Re: how to truncate to get the 1st 5 chars from a string

2009-09-23 Thread Xavier Ho
On Thu, Sep 24, 2009 at 1:05 PM, MacRules wrote: > s="1234abcd" > s.range(0..4) > 1234a > > Is there a string function like this? > > Use the slice. >>> s = "1234abcd" >>> s[:5] '1234a' Cheers, Xav -- http://mail.python.org/mailman/listinfo/python-list

how to truncate to get the 1st 5 chars from a string

2009-09-23 Thread MacRules
s="1234abcd" s.range(0..4) 1234a Is there a string function like this? Thanks -- http://mail.python.org/mailman/listinfo/python-list