Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f2c47114
Kaydet (Commit)
f2c47114
authored
Ock 01, 2003
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Search for Unicode character names using regular expressions.
üst
decc6a47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
find-uname.py
Demo/scripts/find-uname.py
+40
-0
No files found.
Demo/scripts/find-uname.py
0 → 100644
Dosyayı görüntüle @
f2c47114
#!/usr/bin/env python
"""
For each argument on the command line, look for it in the set of all Unicode
names. Arguments are treated as case-insensitive regular expressions, e.g.:
%
find-uname 'small letter a$' 'horizontal line'
*** small letter a$ matches ***
LATIN SMALL LETTER A (97)
COMBINING LATIN SMALL LETTER A (867)
CYRILLIC SMALL LETTER A (1072)
PARENTHESIZED LATIN SMALL LETTER A (9372)
CIRCLED LATIN SMALL LETTER A (9424)
FULLWIDTH LATIN SMALL LETTER A (65345)
*** horizontal line matches ***
HORIZONTAL LINE EXTENSION (9135)
"""
import
unicodedata
import
sys
import
re
def
main
(
args
):
unicode_names
=
[]
for
ix
in
range
(
sys
.
maxunicode
+
1
):
try
:
unicode_names
.
append
(
(
ix
,
unicodedata
.
name
(
unichr
(
ix
)))
)
except
ValueError
:
# no name for the character
pass
for
arg
in
args
:
pat
=
re
.
compile
(
arg
,
re
.
I
)
matches
=
[(
x
,
y
)
for
(
x
,
y
)
in
unicode_names
if
pat
.
search
(
y
)
is
not
None
]
if
matches
:
print
"***"
,
arg
,
"matches"
,
"***"
for
(
x
,
y
)
in
matches
:
print
"
%
s (
%
d)"
%
(
y
,
x
)
if
__name__
==
"__main__"
:
main
(
sys
.
argv
[
1
:])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment