開発環境
- macOS Mojave - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Visual Studio Code (Text Editor)
- Python 3.7 (プログラミング言語)
入門 Python 3 (Bill Lubanovic (著)、斎藤 康毅 (監修)、長尾 高弘 (翻訳)、オライリージャパン)の8章(データの行き先)、8.7(復習問題)8-10.を取り組んでみる。
コード(Emacs)
Python 3
#!/usr/bin/env python3
import sqlalchemy as sa
print('10.')
engine = sa.create_engine('sqlite:///books.db')
rows = engine.execute('SELECT * FROM book ORDER BY title')
for row in rows:
print(row)
入出力結果(Terminal, cmd(コマンドプロンプト), Jupyter(IPython))
$ ./sample10.py
10.
('Perdido Street Station', 'China Miéville', 2000)
('Small Gods', 'Terry Pratchett', 1992)
('The Spellman Files', 'Lisa Lutz', 2007)
('The Weirdstone of Brisingamen', 'Alan Garner', 1960)
('Thud!', 'Terry Pratchett', 2005)
$
0 コメント:
コメントを投稿