2015年2月1日日曜日

開発環境

  • 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 7(Mangle Data Like a Pro)、Things to Do 7.14.を解いてみる。

Things to Do 7.14.

コード(Eacs, BBEdit)

sample14.py

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

import binascii
import struct

hex_string = ('47494638396101000100800000000000ffffff21f9' +
              '0401000000002c000000000100010000020144003b')

gif = binascii.unhexlify(hex_string)

print(struct.unpack('<hh', gif[6:10]))

入出力結果(Terminal, IPython)

$ ./sample14.py
(1, 1)
$

0 コメント:

コメントを投稿