2018年5月18日金曜日

開発環境

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

コード(Emacs)

Python 3

#!/usr/bin/env python3

print('8-11')
import redis

conn = redis.Redis()
conn.hmset('test', {'count': 1, 'name': 'Fester Bestertester'})
print(conn.hgetall('test'))

print('8-12')

conn.hincrby('test', 'count')
print(conn.hgetall('test'))

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

$ ./sample5.py
8-11
{b'count': b'1', b'name': b'Fester Bestertester'}
8-12
{b'count': b'2', b'name': b'Fester Bestertester'}
$

0 コメント:

コメントを投稿