2018年5月17日木曜日

開発環境

入門 Python 3 (Bill Lubanovic (著)、斎藤 康毅 (監修)、長尾 高弘 (翻訳)、オライリージャパン)の8章(データの行き先)、8.7(復習問題)10.を取り組んでみる。

コード(Emacs)

Python 3

#!/usr/bin/env python3

print('8-10')
import sqlalchemy as sa

conn = sa.create_engine('sqlite:///books.db')
sql = 'SELECT title FROM book ORDER BY title'
for row in conn.execute(sql):
    print(row[0])

入出力結果(Terminal, Jupyter(IPython))

$ ./sample4.py
8-10
Perdido Street Station
Small Gods
The Spellman Files
The Weirdstone of Brisingamen
Thud!
$

0 コメント:

コメントを投稿