Re: Why does Python show the whole array?

2009-04-08 Thread Qilong Ren
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 nos...@nospam.com Date: April 8, 2009 5:56:34 PM CST To: python-list@python.org Subject: Why does Python show

pyMPI installation

2007-07-13 Thread Qilong Ren
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

Re: python regular expression help

2007-04-12 Thread Qilong Ren
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' What I want is a = 4.5 b = 'h' 'd' c

python regular expression help

2007-04-11 Thread Qilong Ren
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

Re: python regular expression help

2007-04-11 Thread Qilong Ren
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=4.5'] On Wed, Apr 11, 2007 at 06:10:07PM -0700, Qilong Ren wrote: Hi, everyone, I am

Re: python regular expression help

2007-04-11 Thread Qilong Ren
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 ', 'c=4.5'] On Wed, Apr 11, 2007 at 06:10:07PM -0700, Qilong Ren wrote: Hi, everyone, I am extracting some information from a given

How to get the previous line in a file?

2007-03-16 Thread Qilong Ren
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

Re: How to get the previous line in a file?

2007-03-16 Thread Qilong Ren
- Original 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', r).read().splitlines