2015年2月5日木曜日

開発環境

  • 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.1.を解いてみる。

Things to Do 8.1.

コード(Eacs, BBEdit)

sample1.py

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

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

with open('test.txt', 'w') as f:
    print(test1, file=f, end='')

入出力結果(Terminal, IPython)

$ ./sample1.py
$ cat test.txt 
This is a test of the emergency text system$ 

0 コメント:

コメントを投稿