Re: Help with regex needed

2011-04-12 Thread D'Arcy J.M. Cain
On Tue, 12 Apr 2011 22:11:55 +0300 Yuri Slobodyanyuk wrote: > Thanks for the insight, while this code will run once a week and > optimization isn't really a must here, it is > still a good idea not to leave half-baked code behind me, especially given > that it will be running on this server for

Re: Help with regex needed

2011-04-12 Thread Yuri Slobodyanyuk
Thanks for the insight, while this code will run once a week and optimization isn't really a must here, it is still a good idea not to leave half-baked code behind me, especially given that it will be running on this server for the next 13 years ;) I have one doubt though . Doesn't using the lis

Re: Help with regex needed

2011-04-12 Thread D'Arcy J.M. Cain
On Tue, 12 Apr 2011 15:06:25 +0300 Yuri Slobodyanyuk wrote: > Thanks everybody , and especially Chris - i used split and it took me 15 > mins to make it work :) That's great. One thing though... > for nnn in hhh: > if nnn.split()[2] == str(time_tuple[1]).strip(' \t\n\r') and > nnn.split()

Re: Help with regex needed

2011-04-12 Thread Yuri Slobodyanyuk
Thanks everybody , and especially Chris - i used split and it took me 15 mins to make it work :) The final version looks like: from datetime import datetime, date, time today_day = datetime.now() time_tuple= today_day.timetuple() hhh = open("file_with_data.data",'r') for nnn in hhh: if nnn.sp

Re: Help with regex needed

2011-04-11 Thread Chris Rebert
On Mon, Apr 11, 2011 at 10:20 PM, Yuri Slobodyanyuk wrote: > Good day everyone, > I am trying to make this pretty simple regex to work but got stuck, > I'd appreciate your help . "Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems

Re: Help with regex needed

2011-04-11 Thread Chris Rebert
On Mon, Apr 11, 2011 at 10:20 PM, Yuri Slobodyanyuk wrote: > Good day everyone, > I am trying to make this pretty simple regex to work but got stuck, > I'd appreciate your help . > Task: Get current date , then read file of format below, find the line that > matches > the current date of month,mon

Re: Help with regex needed

2011-04-11 Thread Kushal Kumaran
On Tue, Apr 12, 2011 at 10:50 AM, Yuri Slobodyanyuk wrote: > Good day everyone, > I am trying to make this pretty simple regex to work but got stuck, > I'd appreciate your help . > Task: Get current date , then read file of format below, find the line that > matches > the current date of month,mon

Help with regex needed

2011-04-11 Thread Yuri Slobodyanyuk
Good day everyone, I am trying to make this pretty simple regex to work but got stuck, I'd appreciate your help . Task: Get current date , then read file of format below, find the line that matches the current date of month,month and year and extract the number from such line. Here is what I did ,