What unicode character has a certain value?
Gerhard Haering
gerhard.haering at gmx.de
Tue Jul 23 18:41:24 EDT 2002
* DogWalker <forestiero at qwest.net> [2002-07-23 15:29 -0700]:
> How would I convert the value of a unicode character to a unicode string;
unichr
> a unicode string to an ascii string (if possible);
.encode(encoding, conflict_strategy=None)
for example: u"foobar".encode("utf-16")
> a unicode character to a decimal number.
ord
> If I have the decimal value for a unicode character, how do I convert it to
> a unicode character? A unicode apostrophe has a decimal value of 8217. How
> do I get a string with an apostrophe starting with 8217?
>
> x = 8217
> s = ??x
s = unichr(8217)
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list