Remeber the return value of find function of a string is -1 when it
fails, which is True.
Try:
for item in isp:
if item in test:
print item
From: Gilles Ganault
Date: April 8, 2009 5:56:34 PM CST
To: python-list@python.org
Subject: Why does Python show the whole array?
Hi, All,
I tried to install pyMPI on a linux machine with python2.5 and mpich
installed. But always failed. Anyone who has succeeded with the
installation? What do I need when doing the configuration?
Thanks!
Qilong
--
http://mail.python.org/mailman/listinfo/python-list
python regular expression help
En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren <[EMAIL PROTECTED]>
escribió:
> Thanks for reply. That actually is not what I want. Strings I am dealing
> with may look like this:
> s = 'a = 4.5 b = 'h' 'd' c = 4.5 3.5'
esday, April 11, 2007 8:27:57 PM
Subject: Re: python regular expression help
On Apr 11, 7:41 pm, liupeng <[EMAIL PROTECTED]> wrote:
> pattern = re.compile(r'\w+\s*=\s*[0-9]*.[0-9]*\s*')
> lists = pattern.findall(s)
> print lists
> ['a=4 ', 'b=3.4 '
From: liupeng <[EMAIL PROTECTED]>
To: python-list@python.org
Sent: Wednesday, April 11, 2007 6:41:30 PM
Subject: Re: python regular expression help
pattern = re.compile(r'\w+\s*=\s*[0-9]*.[0-9]*\s*')
lists = pattern.findall(s)
print lists
['a=4 ', 'b=3.4 ', 'c=
Hi, everyone,
I am extracting some information from a given string using python RE. The
string is ,for example,
s = 'a = 4 b =3.4 5.4 c = 4.5'
What I want is :
a = 4
b = 3.4 5.4
c = 4.5
Right now I use :
pattern = re.compile(r'\w+\s*=\s*.*?\s+')
lists = pattern.findall(s)
It
ginal Message
From: Shane Geiger <[EMAIL PROTECTED]>
To: Qilong Ren <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2007 1:51:09 PM
Subject: Re: How to get the previous line in a file?
lines = open('/tmp/foo.py
Hi,all
I am new to this list. And I am glade I am here.
I have a question. I need to do some text processing. I need to read from a
file line by line. If some line is met with some condition, the previous line
needs some modification. How to get the info of the previous line?
Thanks!
Qilong