How do I display unicode value stored in a string variable using ord()

Alister alister.ware at ntlworld.com
Fri Aug 17 02:30:41 EDT 2012


On Thu, 16 Aug 2012 15:09:47 -0700, Charles Jensen wrote:

> Everyone knows that the python command
> 
>      ord(u'…')
> 
> will output the number 8230 which is the unicode character for the
> horizontal ellipsis.
> 
> How would I use ord() to find the unicode value of a string stored in a
> variable?
> 
> So the following 2 lines of code will give me the ascii value of the
> variable a.  How do I specify ord to give me the unicode value of a?
> 
>      a = '…' ord(a)





the same way you did in your original example by defining the string ass 
unicode
a=u'...' ord(a)
-- 
Keep on keepin' on.



More information about the Python-list mailing list