Re: [Tutor] How to print lines within two timestamp

2018-10-27 Thread Alan Gauld via Tutor
On 27/10/2018 08:02, Asad wrote: >>> string = f3.read () >>> regex = re.compile ( "\n" ) >>> st = regex.sub ( " ", string ) >> >> I suspect regular string methods would be simpler here. >> answer : can you please provide the code to replace above st = string.replace("\n"," ") >>> if re.search

[Tutor] How to print lines within two timestamp

2018-10-27 Thread Asad
--- > From: Asad > To: tutor@python.org > Cc: > Bcc: > Date: Fri, 26 Oct 2018 17:03:01 +0530 > Subject: [Tutor] How to print lines within two timestamp > Hi , > > Yes i have the code : > > import re > import datetime > from datetime import timedelta &g

Re: [Tutor] How to print lines within two timestamp

2018-10-26 Thread Peter Otten
Alan Gauld via Tutor wrote: > On 26/10/2018 18:45, Alan Gauld via Tutor wrote: > >> It woiyukld > > No idea what happened there. Should be "would" of course! Of coiyukrse! Nobody thoiyukght otherwiiyske :) ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] How to print lines within two timestamp

2018-10-26 Thread Alan Gauld via Tutor
On 26/10/2018 18:45, Alan Gauld via Tutor wrote: > It woiyukld No idea what happened there. Should be "would" of course! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at:

Re: [Tutor] How to print lines within two timestamp

2018-10-26 Thread Alan Gauld via Tutor
On 26/10/2018 12:33, Asad wrote: > Hi , > > Yes i have the code : It woiyukld help us to help you if you provided some clues as to what it was doing. A good start would be some comments - especially around the regexes. Don't make us parse them without some idea of what you are expecting. Also

[Tutor] How to print lines within two timestamp

2018-10-26 Thread Asad
Hi , Yes i have the code : import re import datetime from datetime import timedelta Header = "*" f3 = open ( r"D:\QI\logA.txt", 'r' ) string = f3.read () regex = re.compile ( "\n" ) st = regex.sub ( " ", string ) st1 = st.split ( " " ) if