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.split()[2] == str(time_tuple[1]).strip(' \t\n\r') and nnn.split()[4] == str(time_tuple[0]).strip(' \t\n\r') and nnn.split()[3] == str(time_tuple[2]).strip(' \t\n\r') : print nnn Cheers and good day everyone Yuri On Tue, Apr 12, 2011 at 8:58 AM, Chris Rebert <c...@rebertia.com> wrote: > On Mon, Apr 11, 2011 at 10:20 PM, Yuri Slobodyanyuk > <yuri.slobodyan...@gmail.com> 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." > > <snip> > > 1111111 Fri 4 8 2011 > > 2323232 Fri 4 15 2011 > > 4343434 Fri 4 22 2011 > > 8522298 Fri 4 29 2011 > > ......... > > 5456678 Fri 10 28 2011 > > 5633333 Fri 11 4 2011 > > 4141411 Fri 11 11 2011 > > 3324444 Fri 11 18 2011 > > There's no need to use regexes to parse such a simple file format. > Just use str.split() [without any arguments] on each line of the file, > and do the field equality checks yourself; your code will simpler. > Relevant docs: http://docs.python.org/library/stdtypes.html#str.split > > Cheers, > Chris > -- > http://blog.rebertia.com > -- Taking challenges one by one. http://yurisk.info http://ccie-security-blog.com
-- http://mail.python.org/mailman/listinfo/python-list