"Dave Angel" wrote
But you have a serious bug in your code, that nobody in the first five
responses has addressed. That while loop will loop over the first line
repeatedly, till it reaches or exceeds 1000, regardless of the length of
subsequent lines.
Oooh, good catch, I completely miss
ramya natarajan wrote:
Hello,
I am very beginner to programming, I got task to Write a loop that
reads
each line of a file and counts the number of lines that are read until
the
total length of the lines is 1,000 characters. I have to read lines from
files exactly upto 1000 characters.
Her
"spir ☣" wrote
Either you read line per line, but then you cannot stop exactly at the 1000th
character;
or you traverse the text char per char, but this is a bit picky.
Or you could just read 1000 chars from the file then pick out the lines from
that.
But that requires you to count newlin
On 12-May-2010, at 12:32 AM, spir ☣ wrote:
> On Tue, 11 May 2010 11:00:20 -0700
> ramya natarajan wrote:
>
>> Hello,
>>
>> I am very beginner to programming, I got task to Write a loop that reads
>> each line of a file and counts the number of lines that are read until the
>> total length of
On Tue, 11 May 2010 11:00:20 -0700
ramya natarajan wrote:
> Hello,
>
> I am very beginner to programming, I got task to Write a loop that reads
> each line of a file and counts the number of lines that are read until the
> total length of the lines is 1,000 characters. I have to read lines fro
On Tue, May 11, 2010 at 1:00 PM, ramya natarajan wrote:
> Hello, I have to read lines from
> files exactly upto 1000 characters.
>But the problem is its reading entire line and not stopping
> excatly in 1000 characters. Can some one help what mistake i am doing here?.
>
> log = open('/tmp/new.t
Hello,
I am very beginner to programming, I got task to Write a loop that reads
each line of a file and counts the number of lines that are read until the
total length of the lines is 1,000 characters. I have to read lines from
files exactly upto 1000 characters.
Here is my code:
I created fil