$ pip install pinyin4py from anjuke import pinyin converter = pinyin.Converter() converter.load_word_file('words.txt') print converter.convert('中文测试')