Read Data From Multiple Files (Task)

In this task, you’ll extend the functionality of your wordcount command to read data from multiple files. You’ll handle each file separately, calculate the number of lines, words, and bytes for each, and provide a summary if multiple files are involved.

Acceptance Criteria

  • Your program should correctly read data from each file specified in the command-line arguments.
  • For each file, it should print the count of lines, words, and bytes on separate lines.
  • If multiple files are provided, then your program should include a summary with the total counts for lines, words, and bytes.
  • It should be possible to repeat the same file multiple times in the command-line arguments.
  • The program should read from standard input when the dash (-) is provided as one or more command-line arguments.
  • The program should be able to mix files with standard input.

Examples

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.