1. å¤æå符串ä¸æ¯å¦å«ææ±åã
def has_hz(text):
hz_yes = False
for ch in text:
if isinstance(ch, unicode):
if unicodedata.east_asian_width(ch)!= 'Na':
hz_yes = True
break
else:
continue
return hz_yes
def has_hz(text):
hz_yes = False
for ch in text:
if isinstance(ch, unicode):
if unicodedata.east_asian_width(ch)!= 'Na':
hz_yes = True
break
else:
continue
return hz_yes
åå
æµè¯ï¼
assert not has_hz("")
assert not has_hz(" ")
assert not has_hz("123")
assert not has_hz(u"123abc")
assert has_hz(u"123abcæ±å")
assert has_hz(u"æ±å")
assert not has_hz("")
assert not has_hz(" ")
assert not has_hz("123")
assert not has_hz(u"123abc")
assert has_hz(u"123abcæ±å")
assert has_hz(u"æ±å")
温馨提示:答案为网友推荐,仅供参考