Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how to truncate to get the 1st 5 chars from a string

Reply
Thread Tools

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

 
 
MacRules
Guest
Posts: n/a
 
      09-24-2009
s="1234abcd"
s.range(0..4)
1234a

Is there a string function like this?

Thanks
 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      09-24-2009
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

 
Reply With Quote
 
 
 
 
Donn
Guest
Posts: n/a
 
      09-24-2009
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/fontypython/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to truncate char string fromt beginning and replace chars instring by other chars in C or C++? Hongyu C++ 9 08-08-2008 12:18 PM
peterborough uk shortage of 1st 1st line jobs gerry MCSE 91 03-12-2008 06:03 PM
DirectoryExists on 1st 4 chars David C ASP .Net 2 11-19-2007 03:52 PM
truncate string to last full stop (within 160 chars) Stimp ASP .Net 2 10-27-2006 05:47 PM



Advertisments