[英]selecting unicode characters from text file or webpage
我能够对下页所示的梵文单词进行音节化。
https://gist.github.com/950405
但是我想做的是从以下网页中找到以“ह”开头的单词。
http://www.sacred-texts.com/hin/mbs/mbs12030.htm
如何使用python完成?
如果您的单词是Unicode字符串(收集在列表中的words
,则以下代码段将显示所有以"x"
开头的单词
for word in words:
if word.startswith(u"x"):
print word
或者,如果您想获取以u"x"
开头的所有单词的列表,则可以使用列表推导:
selected_words = [ w for w in words if w.startswith(u"x") ]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.