私はユニコードのデータ文字を扱っていますが、なぜユニコードデータに名前がないのか不思議です。ここでは、あなたがチェックできるサンプルコードです<unknown>
Python、unicodedataの名前、コードポイントの値は何ですか?
私はユニコードデータベース内のすべての文字は、BTWにはすべて同じカテゴリの[Cc] Other, Control
があると思った。
別の質問:どのようにしてユニコードコードポイント値を取得できますか?それはord(unicodechar)
トリックですか?
私はファイルhere(エンコーディングは奇妙なものです)を入れました。そして、私のカットアンドペーストが '見えない'文字でできている可能性があります。
#!/bin/env python
# -*- coding: utf-8 -*-
#extracted and licensing from here:
"""
:author: Laurent Pointal <[email protected]> <[email protected]>
:organization: CNRS - LIMSI
:copyright: CNRS - 2004-2009
:license: GNU-GPL Version 3 or greater
:version: $Id$
"""
# Chars alonemarks:
# !?¿;,*¤@°:%|¦/()[]{}<>«»´`¨&~=#±£¥$©®"
# must have spaces around them to make them tokens.
# Notes: they may be in pchar or fchar too, to identify punctuation after
# a fchar.
# \202 is a special ,
# \226 \227 are special -
alonemarks = u"!?¿;,\202*¤@°:%|¦/()[\]{}<>«»´`¨&~=#±\226"+\
u"\227£¥$©®\""
import unicodedata
for x in alonemarks:
unicodename = unicodedata.name(x, '<unknown>')
print "\t".join(map(unicode, (x, len(x), ord(x), unicodename, unicodedata.category(x))))
# unichr(int('fd9b', 16)).encode('utf-8')
# http://stackoverflow.com/questions/867866/convert-unicode-codepoint-to-utf8-hex-in-python
errr、いや、それは 'ord'だ、' ORD' –
私は、 – georg
OK誰か...があるだろう知っていないあなたに感謝:) を(はい、実際に、私は大文字の中に書かれていますが、そうではないことを知っていたしています) – user1340802