I was looking at some word count code and thought a more functional approach would be better and more fun to code.
1 | lengths = map(lambda word: len(word), open("foo.txt","r").readline().split())
|
This method was used for its simplicity.
Tags: word_count
An even better approach is to simply do this:
:)
--JamesMills / prologic
Actually I'm stupid :) Just:
:)