開発環境
- 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.12.を解いてみる。
Things to Do 7.12.
コード(Eacs, BBEdit)
sample12.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import binascii
hex_string = ('47494638396101000100800000000000ffffff21f9' +
'0401000000002c000000000100010000020144003b')
gif = binascii.unhexlify(hex_string)
print(gif)
入出力結果(Terminal, IPython)
$ ./sample12.py b'GIF89a\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\xff\xff\xff!\xf9\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x01D\x00;' $
0 コメント:
コメントを投稿