[Python-de] Re: Fwd: Keyboard coding
Wolli Buechel über python-de <[email protected]> Wed, 24 Jul 2024 15:55:03 -0000
| Newsgroups | gmane.comp.python.general.german |
|---|---|
| Message-ID | <[email protected]> |
Sehr geehrter Herr Schnoor,
Mehrfachzeichen in ziffern sind nicht lediglich "einige chinesische Zeichen" und auch nicht bloß "doppelt", sondern insgesamt 66 Zeichen aus folgenden Schriftsystemen:
DEVANAGARI : 6
BENGALI : 4
ORIYA : 3
TIBETAN : 7
KHMER : 11
OL CHIKI : 4
GEORGIAN : 20
CJK : 11
Dies kann man mit dem Python-Modul unicodedata herausfinden:
import unicodedata # Python-Doku: https://docs.python.org/3/library/unicodedata.html
# extrahiere aus ziffern : Mehrfachzeichen, Zeilenumbrüche, Leerzeichen
mehrfach = sorted(list(set([ x for x in ziffern if ziffern.count(x) > 1 or x in "\n\t " ])))
Names = dict()
for i, ch in enumerate(mehrfach):
try:
chName = unicodedata.name(ch)
except:
chName = unicodedata.category(ch)
language = chName.split()[0]
if 'OL' in language:
language = ' '.join(chName.split()[:2])
Names[language] = Names.get(language, 0) + 1
# print("[%2d] >%s<\t%5d\t%s" % (i+1, ch, ord(ch), chName))
for k, v in Names.items():
print("%s \t: %2d" % (k, v))
W. Buechel
_______________________________________________
python-de Mailingliste -- [email protected]
Zur Abmeldung von dieser Mailingliste senden Sie eine Nachricht an [email protected]
https://mail.python.org/mailman3/lists/python-de.python.org/
Mitgliedsadresse: [email protected]