2015年2月6日金曜日

開発環境

  • 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 8(Data Has to Go Somewhere)、Things to Do 8.2.を解いてみる。

Things to Do 8.2.

コード(Eacs, BBEdit)

sample2.py

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

test1 = 'This is a test of the emergency text system'

with open('test.txt') as f:
    test2 = f.read()

print(test1 == test2)           #  True
print(test2)

入出力結果(Terminal, IPython)

$ ./sample2.py
True
This is a test of the emergency text system
$

0 コメント:

コメントを投稿