mywc - lines = lines + 1 words = words + len(line.split())...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python ## mywc -- count lines, words, and characters in stdin import sys lines = 0 words = 0 chars = 0 for line in sys.stdin.readlines():
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lines = lines + 1 words = words + len(line.split()) chars = chars + len(line) print lines,words,chars...
View Full Document

Ask a homework question - tutors are online