Re: split and regexp on textfile

2007-04-15 Thread Gabriel Genellina
En Fri, 13 Apr 2007 07:08:05 -0300, Flyzone <[EMAIL PROTECTED]> escribió: > A little question: the pat.split can split without delete the date? No, but instead of reading the whole file and splitting on dates, you could iterate over the file and detect block endings: def split_on_dates(ftopa

Re: split and regexp on textfile

2007-04-13 Thread mik3l3374
On Apr 13, 6:08 pm, "Flyzone" <[EMAIL PROTECTED]> wrote: > On 13 Apr, 11:30, "Flyzone" <[EMAIL PROTECTED]> wrote: > > > all together :( > > Damn was wrong mine regexp: > pat = re.compile("[A-Z][a-z][a-z][ ][A-Z][a-z][a-z][ ][0-9| ][0-9][ ] > [0-9][0-9][:][0-9][0-9]",re.M|re.DOTALL) > > now is worki

Re: split and regexp on textfile

2007-04-13 Thread Flyzone
On 13 Apr, 11:30, "Flyzone" <[EMAIL PROTECTED]> wrote: > all together :( Damn was wrong mine regexp: pat = re.compile("[A-Z][a-z][a-z][ ][A-Z][a-z][a-z][ ][0-9| ][0-9][ ] [0-9][0-9][:][0-9][0-9]",re.M|re.DOTALL) now is working! :) Great! really thanks for the helps! A little question: the pat.s

Re: split and regexp on textfile

2007-04-13 Thread bearophileHUGS
Flyzone: > i have a problem with the split function and regexp. > I have a file that i want to split using the date as token. My first try: data = """ error text Mon Apr 9 22:30:18 2007 text text Mon Apr 9 22:31:10 2007 text text Mon Apr 10 22:31:10 2007 text text """ import re date_find = re.

Re: split and regexp on textfile

2007-04-13 Thread Flyzone
On 13 Apr, 11:14, [EMAIL PROTECTED] wrote: > change to pat.split(data) then. next what i have tried originally..but is not working, my result is here: ["Mon Feb 26 11:25:04 2007\ntext\n text\ntext\nMon Feb 26 11:25:16 2007\ntext\n text\n text\nMon Feb 26 17:06:41 2007\ntext"] all together :(

Re: split and regexp on textfile

2007-04-13 Thread mik3l3374
On Apr 13, 4:55 pm, "Flyzone" <[EMAIL PROTECTED]> wrote: > On 13 Apr, 10:40, [EMAIL PROTECTED] wrote: > > > you trying to match the date part right? if re is what you desire, > > here's one example: > > Amm..not! I need to get the text-block between the two data, not the > data! :) change to pat.s

Re: split and regexp on textfile

2007-04-13 Thread Flyzone
On 13 Apr, 10:40, [EMAIL PROTECTED] wrote: > you trying to match the date part right? if re is what you desire, > here's one example: Amm..not! I need to get the text-block between the two data, not the data! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: split and regexp on textfile

2007-04-13 Thread mik3l3374
On Apr 13, 3:59 pm, "Flyzone" <[EMAIL PROTECTED]> wrote: > Hi, > i have a problem with the split function and regexp. > I have a file that i want to split using the date as token. > Here a sample: > - > Mon Apr 9 22:30:18 2007 > text > text > Mon Apr 9 22:31:10 2007 > text > text > > > I

split and regexp on textfile

2007-04-13 Thread Flyzone
Hi, i have a problem with the split function and regexp. I have a file that i want to split using the date as token. Here a sample: - Mon Apr 9 22:30:18 2007 text text Mon Apr 9 22:31:10 2007 text text I'm trying to put all the lines in a one string and then to separate it (could be bet