[EMAIL PROTECTED] ~]# python
Python 2.5.1 (r251:54863, Nov 23 2007, 16:16:53)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import re
>>>
>>> a = 'this is a simple 3xampl3 of 2 or 3 numb3rs' # some text
>>> b = re.su
Dinesh B Vadhia wrote:
I want to remove whole numbers from text but retain numbers attached to
words. All whole numbers to be removed have a leading and trailing space.
For example, in "the cow jumped-20 feet high30er than the lazy 20 timing
fox who couldn't keep up the 865 meter race." remov
Dear Dinesh,
if you're using the regular expression only once, I would recommend:
without_numbers = " ".join(re.split(" [0-9]+ ", phrase))
If not, compile the regular expression first and use the compiled version.
Regards,
Benoit Thiell.
On Sat, 2 Aug 2008, Noufal Ibrahim wrote:
Alan Gauld w
Alan Gauld wrote:
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
I want to remove whole numbers from text but retain numbers
attached to words.
Is this a homework?
If so we can only offer suggestions to direction but not give solutions.
What is the best to do this using re?
Yes, use re to d
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
I want to remove whole numbers from text but retain numbers
attached to words.
Is this a homework?
If so we can only offer suggestions to direction but not give
solutions.
What is the best to do this using re?
Yes, use re to define a pattern t
I want to remove whole numbers from text but retain numbers attached to words.
All whole numbers to be removed have a leading and trailing space.
For example, in "the cow jumped-20 feet high30er than the lazy 20 timing fox
who couldn't keep up the 865 meter race." remove the whole numbers 20 an