Re: [Tutor] Remove a number from a string

2005-08-24 Thread Alan G
>> s = ' '.join(s.split()[1:]) > > or just > s = s.split(None, 1)[1] Neat, I hadn't noticed the maxsplit parameter before. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Remove a number from a string

2005-08-23 Thread Kent Johnson
Alan G wrote: >>Suppose i have a string '347 liverpool street'. >>I want to remove all the numbers coming at the starting of the >>string. >>I can think of a few ways but whats the cleanest way to do it? > > > If you know they are always a contiguous string themn a simple split() > call will do

Re: [Tutor] Remove a number from a string

2005-08-23 Thread Alan G
> Suppose i have a string '347 liverpool street'. > I want to remove all the numbers coming at the starting of the > string. > I can think of a few ways but whats the cleanest way to do it? If you know they are always a contiguous string themn a simple split() call will do it: s = ' '.join(s.sp

Re: [Tutor] Remove a number from a string

2005-08-23 Thread Byron
Shitiz Bansal wrote: > Hi, > Suppose i have a string '347 liverpool street'. > I want to remove all the numbers coming at the starting of the string. > I can think of a few ways but whats the cleanest way to do it? > > Shitiz Here's a function that can do what you're wanting to accomplish: By

Re: [Tutor] Remove a number from a string

2005-08-23 Thread Kent Johnson
Shitiz Bansal wrote: > Hi, > Suppose i have a string '347 liverpool street'. > I want to remove all the numbers coming at the starting of the string. > I can think of a few ways but whats the cleanest way to do it? With str.lstrip(): >>> '347 liverpool street'.lstrip('0123456789') ' liverpool st

Re: [Tutor] Remove a number from a string

2005-08-23 Thread Luis N
On 8/23/05, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > Hi, > Suppose i have a string '347 liverpool street'. > I want to remove all the numbers coming at the starting of the string. > I can think of a few ways but whats the cleanest way to do it? > > Shitiz > I believe this question to be