Re: [Tutor] Iterate Suggestion

2012-04-15 Thread Peter Otten
Tom Tucker wrote: > Hello all. Any suggestions how I could easily iterate over a list and > print the output 3 across (when possible)? One method I was considering > was removing the recently printed item from the list, checking list > length, > etc. Based on the remaining length of the list I

Re: [Tutor] Help with regular expression

2012-04-15 Thread syed zaidi
Thanks for the help I need the whole line starting from 'D' but in seperate columns.like KO, EC, Gene ID, Enzyme Name etc > Date: Mon, 16 Apr 2012 00:24:17 +1000 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] Help with regular expression > > syed zaidi wrote: > > Dea

Re: [Tutor] Iterate Suggestion

2012-04-15 Thread bob gailer
On 4/14/2012 11:27 AM, Tom Tucker wrote: Hello all. Any suggestions how I could easily iterate over a list and print the output 3 across (when possible)? One method I was considering was removing the recently printed item from the list, checking list length, etc. Based on the remaining len

Re: [Tutor] re.search() help

2012-04-15 Thread Walter Prins
Hi Michael, On 16 April 2012 01:20, Michael Lewis wrote: > So that you can find the section of a long string that >> first matches your regex. >> >> > Why not use re.findall() for that? It seems like re.findall() can fill > this need and I wouldn't need to use re.search()? Can you compare an > e

Re: [Tutor] re.search() help

2012-04-15 Thread Alan Gauld
On 16/04/12 00:20, Michael Lewis wrote: > What is the purpose of this? So that you can find the section of a long string that first matches your regex. Why not use re.findall() for that? It seems like re.findall() can fill this need and I wouldn't need to use re.search()? Can you

Re: [Tutor] re.search() help

2012-04-15 Thread Michael Lewis
> > Message: 6 > Date: Sun, 15 Apr 2012 08:48:10 +0100 > From: Alan Gauld > To: tutor@python.org > Subject: Re: [Tutor] re.search() help > Message-ID: > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 15/04/12 08:10, Michael Lewis wrote: > > Hi everyone, > > > > I am a bit conf

Re: [Tutor] Help with regular expression

2012-04-15 Thread Steven D'Aprano
syed zaidi wrote: Dear Steve,Tutor doesn't allow attachment of huge files. I am attaching the files I am taking as input, code and the output CSV file. I hope then you would be able to help me. DOT keg files open in file viewer, you can also view them in python. The CSV file is the desired output

Re: [Tutor] Problem with mechanize and forms

2012-04-15 Thread Andreas Perstinger
On 2012-04-14 17:46, Karim Gorjux wrote: But I can't get any of these forms! I need the first form so I tried br.select_form(nr=0) but I get None! With "br.select_form()" you set the current form which is accessible through the "br.form" attribute. The method itself doesnt't return anything

Re: [Tutor] Python Fails to Change Directory

2012-04-15 Thread Steven Buroff
Just to support Andrew, I've got several scripts that use os.chdir and they all run fine with 3.2.3. Steve > -Original Message- > From: tutor-bounces+sburoff=optonline@python.org [mailto:tutor- > bounces+sburoff=optonline@python.org] On Behalf Of Steven D'Aprano > Sent: Sunday, Ap

Re: [Tutor] Python Fails to Change Directory

2012-04-15 Thread Dave Angel
On 04/15/2012 01:32 AM, Steven D'Aprano wrote: > Andrew Jahn wrote: >> Hi all, >> >> I am attempting to use a Python program to change into a specified >> directory before executing some commands. However, when I call the >> Python >> program from my Unix shell (tcsh) using a command such as >> >>

Re: [Tutor] Questions Regarding Sockets

2012-04-15 Thread Khalid Al-Ghamdi
Thanks a lot. You've been, as usual, very helpful. On Sat, Apr 14, 2012 at 8:32 PM, Alan Gauld wrote: > On 14/04/12 17:41, Khalid Al-Ghamdi wrote: > > 1- In line (15), what are these variables tcpCliSock,addr supposed to >> hold and do? >> > > The socket object and the IP address of the client t

Re: [Tutor] Help with regular expression

2012-04-15 Thread Steven D'Aprano
syed zaidi wrote: Dear all Can someone please tell me how to solve the following problem. I have developed a python code to extract specific information from more than 1000 files which have slightly different format. The problem I am facing is that I have to develop specific RE for each of the

[Tutor] Help with regular expression

2012-04-15 Thread syed zaidi
Dear all Can someone please tell me how to solve the following problem. I have developed a python code to extract specific information from more than 1000 files which have slightly different format. The problem I am facing is that I have to develop specific RE for each of the file which is ve

Re: [Tutor] re.search() help

2012-04-15 Thread Alan Gauld
On 15/04/12 08:10, Michael Lewis wrote: Hi everyone, I am a bit confused on how one would ever use re.search(). It essentially tells me the location on (RAM?) if the pattern matches? No it returns a MatchObject instance. You can then perform various operations on the MatchObject to, for exampl

[Tutor] re.search() help

2012-04-15 Thread Michael Lewis
Hi everyone, I am a bit confused on how one would ever use re.search(). It essentially tells me the location on (RAM?) if the pattern matches? What is the purpose of this? Can you give me a good example of where it would be useful? Thanks! re.search(*pattern*, *string*, *flags=0*)