Re: [Tutor] character counter

2009-06-29 Thread Sander Sweers
2009/6/27 julie : > file = open("/Users/meitalamitai/Documents/Computer > Science/Python/Homework/Lorem_Ipsum.py") > lines = 0 > for line in file: >     lines=lines+1 > print '%r has %r lines' % ("Lorem_Ipsum.py", lines) >    if char >= 1000: >     break You can do something like below (untest

Re: [Tutor] character counter

2009-06-28 Thread Christian Witts
julie wrote: Hello, I need help with the following problem: *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. Use a break statement to make sure that you don't continue reading the file once the

Re: [Tutor] character counter

2009-06-27 Thread Emile van Sebille
On 6/27/2009 6:42 AM julie said... Hello, I need help with the following problem: *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. Use a break statement to make sure that you don't continue read

Re: [Tutor] character counter

2009-06-27 Thread Richard Lovely
2009/6/27 julie : > Hello, > > I need help with the following problem: > > 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. Use a > break statement to make sure that you don't continue reading the fil