Issue
http://dragonmapper.readthedocs.org/en/latest/readme.html
I'm trying to use dragonmapper to convert characters to pinyin, and I'm trying the tutorial but I'm stuck. http://dragonmapper.readthedocs.org/en/latest/tutorial.html
from dragonmapper import hanzi
s = '这个字怎么念?'
pinyin = hanzi.to_pinyin(s)
At this point pinyin
is an empty string u''
. What am I doing wrong?
(also asked here: https://github.com/tsroten/dragonmapper/issues/11)
Solution
Aha, I forgot to mark the string as unicode:
s = u'这个字怎么念?'
alternatively, make strings unicode:
from __future__ import unicode_literals
Answered By - astromme
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.