2015年2月16日月曜日

開発環境

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

Things to Do 8.11.

コード(Eacs, BBEdit)

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

import redis

conn = redis.Redis()

conn.hmset('test', dict(count=1, name='Fester Bestertester'))

print(conn.hgetall('test'))
for k, v in conn.hgetall('test').items():
    print('{0}: {1}'.format(k, v))
    

入出力結果(Terminal, IPython)

$ ./sample11.py
{b'name': b'Fester Bestertester', b'count': b'1'}
b'name': b'Fester Bestertester'
b'count': b'1'
$

0 コメント:

コメントを投稿