2015年1月19日月曜日

開発環境

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

Things to Do 7.3.

コード(BBEdit)

sample3.py

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

mystery = '\U0001f4a9'
pop_bytes = mystery.encode('utf-8')
pop_string = pop_bytes.decode('utf-8')
print(pop_string, pop_string == mystery, sep='\n')

入出力結果(Terminal, IPython)

$ ./sample3.py
💩
True
$

0 コメント:

コメントを投稿