前置き
Facebookの高専時代の研究室OBグループに以下のお題が投稿された.
"Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics." という文章の、それぞれの単語の文字数を数えると円周率になっている。
JavaScript, Rubyがすでに登録されてたのでPythonで頑張ってみた。
Twitterに貼れるサイズじゃなかったのでQiitaに書く。
ワンライナー
解説するまでもないのでワンライナー。
$ python -c "import re; print map(len, re.compile('[a-z]+', re.I).findall('Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.'));"
バージョン
python --version
Python 2.7.8