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
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
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
s="1234abcd"
s.range(0..4)
1234a
Is there a string function like this?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list