Question: using python: Write a program that opens a file named in.txt and reads each line. For each line in the file, print the line number,

using python:

Write a program that opens a file named in.txt and reads each line. For each line in the file, print the line number, the number of characters in the line, and the line itself. For example, given the following in.txt file:

I am a file. This is a line. This is the last line. 

The output would be:

Line 0 (12 chars): I am a file. Line 1 (15 chars): This is a line. Line 2 (22 chars): This is the last line. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!