2012-01-04から1日間の記事一覧
ascii 文字列は ==, is のどちらでも同じ結果を返します。 一方、unicode 文字列は is で比較した場合の結果が異なります。 # ascii 文字列の比較 a = 'str' b = 'str' a == b >>> True a is b >>> True # unicode 文字列の比較 a = u'str' b = u'str' a == …
ascii 文字列は ==, is のどちらでも同じ結果を返します。 一方、unicode 文字列は is で比較した場合の結果が異なります。 # ascii 文字列の比較 a = 'str' b = 'str' a == b >>> True a is b >>> True # unicode 文字列の比較 a = u'str' b = u'str' a == …