開発環境
- OS X Yosemite - Apple (OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Python 3.4 (プログラミング言語)
Introducing Python: Modern Computing in Simple Packages(Bill Lubanovic (著)、 O'Reilly Media)のChapter 7(Mangle Data Like a Pro)、Things to Do 7.5.を解いてみる。
Things to Do 7.5.
コード(BBEdit)
sample5.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
letter = '''Dear {salutation} {name},
Thank you for your letter. We are sorry that our {product} {verbed} in your
{room}. Please note that it should never be used in {room}, especially
near any {animals}.
Send us your receipt and {amount} for shipping and handling. We will send
you another {product} that, in our tests, is {percent}% less likely to
have {verbed}.
Thank you for your support.
Sincerely,
{spokesman}
{job_title}'''
print(letter)
入出力結果(Terminal, IPython)
$ ./sample5.py Dear {salutation} {name}, Thank you for your letter. We are sorry that our {product} {verbed} in your {room}. Please note that it should never be used in {room}, especially near any {animals}. Send us your receipt and {amount} for shipping and handling. We will send you another {product} that, in our tests, is {percent}% less likely to have {verbed}. Thank you for your support. Sincerely, {spokesman} {job_titl} $
0 コメント:
コメントを投稿