python 文字コード 判定

>>> import chardet
>>> s='あいう'
>>> a=chardet.detect(s)
>>> type(a)
<type 'dict'>
>>> a['confidence']
0.87624999999999997
>>> a['encoding']
'utf-8'