2015年1月18日日曜日

開発環境

Introducing Python: Modern Computing in Simple Packages(Bill Lubanovic (著)、 O'Reilly Media)のChapter 7(Mangle Data Like a Pro)、Things to Do 7.2.を解いてみる。

Things to Do 7.2.

コード(BBEdit)

sample2.py

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

mystery = '\U0001f4a9'
pop_bytes = mystery.encode('utf-8')

print(pop_bytes)

入出力結果(Terminal, IPython)

$ ./sample2.py
b'\xf0\x9f\x92\xa9'
$

0 コメント:

コメントを投稿