获取所有希腊unicode字符的列表

Mic*_*h57 1 python unicode python-module-unicodedata

我想知道如何获取所有希腊字符(大写和小写字母)的列表。我知道如何查找特定字符(unicodedata.lookup(name)),但是我希望所有大写和小写字母。

有什么办法吗?

kin*_*all 5

Unicode标准规定的范围内0x370通过0x3ff(含)希腊语和科普特符号。完全属于科普特语(即不与希腊语共享)的符号是0x3e2通过0x3ef(包括)。

因此,您可以遍历两个范围0x370-0x3e1(包括)和0x3f0-0x3ff(包括),以获取所有希腊符号,并使用它们str.isalpha()来测试每个字母是否为字母。例如:

from itertools import chain
greek_codes   = chain(range(0x370, 0x3e2), range(0x3f0, 0x400))
greek_symbols = (chr(c) for c in greek_codes)
greek_letters = [c for c in greek_symbols if c.isalpha()]
Run Code Online (Sandbox Code Playgroud)