LoginSignup
2
2

More than 5 years have passed since last update.

どこかで聞いたしゃべり方をするワンライナー

Last updated at Posted at 2013-11-11

あまりに下らないので閲覧注意.

Python2とPython3の文字列の扱いが異なることが分かるくらい。
Python3はユニコード文字列⇔バイト文字列の変換がなくて気楽でいい。

python2
# 標準入出力はUTF-8前提

# Python2.7
$ python -c "import sys;print(u'\"'.join(unicode(sys.argv[1], 'utf-8')))" とおしてそこてかんはるんたよぉぉぉぉ
# と"お"し"て"そ"こ"て"か"ん"は"る"ん"た"よ"ぉ"ぉ"ぉ"ぉ

# Python3.3
$ python -c "import sys;print('\"'.join(sys.argv[1]))" とおしてそこてかんはるんたよぉぉぉぉ
# と"お"し"て"そ"こ"て"か"ん"は"る"ん"た"よ"ぉ"ぉ"ぉ"ぉ
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2