string or worse. Good luck.
-Original Message-
From: Tutor On Behalf Of
Asad
Sent: Sunday, November 11, 2018 8:54 PM
To: tutor@python.org
Subject: Re: [Tutor] Example for read and readlines() (Asad)
Hi All ,
Thanks for the reply . I am building a framework for the two error
conditio
On 12Nov2018 07:24, Asad wrote:
Thanks for the reply . I am building a framework for the two
error
conditions, therefore I need to read and readlines because in one only
regex is required and in other regex+ n-1 line is required to process :
#Here we are opening the file and substi
thor 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:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
>
>
>
> -- Forwarded message --
> From: Alan Ga
On 11/11/2018 10:04, Asad wrote:
> 1) and I want to extract the start time , error number and end
> time from this logfile so in this case what should I use I guess option 1 :
>
> with open(filename, 'r') as f:
> for line in f:
> process(line)
Yes, that woyuld be the best
ot visible so can we verify in someway to proof EOL \n is placed
in the file .
Thanks,
>
>
>
>
>
> -- Forwarded message --
> From: Asad
> To: tutor@python.org
> Cc:
> Bcc:
> Date: Sun, 11 Nov 2018 12:19:36 +0530
> Subject: [Tu
On 11/11/2018 09:40, Steven D'Aprano wrote:
>> f3 = open ( r"/a/b/c/d/test/test_2814__2018_10_05_12_12_45/logA.log", 'r' )
>
> Don't use raw strings r"..." for pathnames.
Umm, Why not?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_
On 11/11/2018 06:49, Asad wrote:
> Hi All ,
>
> If I am loading a logfile what should I use from the option 1,2,3
>
> f3 = open ( r"/a/b/c/d/test/test_2814__2018_10_05_12_12_45/logA.log", 'r' )
>
> 1) should only iterate over f3
This is best for processing line by line which is the mos
On Sun, Nov 11, 2018 at 12:19:36PM +0530, Asad wrote:
> Hi All ,
>
> If I am loading a logfile what should I use from the option 1,2,3
Depends what you want to do. I assume that the log file is formatted
into lines of text, so you probably want to iterate over each line.
with open(file
Hi All ,
If I am loading a logfile what should I use from the option 1,2,3
f3 = open ( r"/a/b/c/d/test/test_2814__2018_10_05_12_12_45/logA.log", 'r' )
1) should only iterate over f3
2) st = f3.read()
Should iterate over st
3) st1 = f3.readlines()
Should iterate over st1
How are the