Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ascii': 0.07; 'subject:How': 0.09; 'python': 0.09; 'behave': 0.09; 'subject:()': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'stored': 0.10; 'aug': 0.13; 'encoding': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ord': 0.16; 'presume': 0.16; 'subject:unicode': 0.16; 'subject:variable': 0.16; 'there..': 0.16; 'string': 0.17; 'wrote:': 0.17; 'specify': 0.17; 'unicode': 0.17; 'variable': 0.20; 'received:209.85.214.174': 0.21; 'header :In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'lines': 0.28; 'fri,': 0.30; 'figure': 0.30; 'code': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'your': 0.60; "you'll": 0.62; 'charset:windows-1252': 0.65; 'talking': 0.66; 'subject:value': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=2BOYoS+dEWfbEx124DHsQ49UTgtvg8o3Edws/oIAd5Y=; b=MsyE7KEMTVZuwDRGiihBdoDKt5Xh0jUW9Q0riocXuoCeDkxKhsKUPHhjHWNhYOYOCh mgXhEpa67JjzJ/AG3XFEKwPhZ4vAjMwLXGyUok8/sgvSGOTL9OYlIgTI2s1rcE0HPupD G3Mr8ObjrwaI4u8qDFcI1qFOi15FJTxocKMTyVxmEbccwbDAz7Y8iibtOYDTgNgMNaoY bJFTY7asU337t6dZF8NPh+AkiXVslVRCtaMeJanBFvsB6EC8doDojBBxvdgmduvKthOG 21MhdvLqzZM5k/onz7m2OFReeG8RcgwAnqaLNqMcli3+GUYyZ/Rb5LaMoFMFv4CHsSSP IZ3Q== MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 17 Aug 2012 08:20:15 +1000 Subject: Re: How do I display unicode value stored in a string variable using ord() From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345155618 news.xs4all.nl 6940 [2001:888:2000:d::a6]:58991 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27205 On Fri, Aug 17, 2012 at 8:09 AM, Charles Jensen wrote: > How would I use ord() to find the unicode value of a string stored in a v= ariable? > > So the following 2 lines of code will give me the ascii value of the vari= able a. How do I specify ord to give me the unicode value of a? > > a =3D '=85' > ord(a) I presume you're talking about Python 2, because in Python 3 your string variable is a Unicode string and will behave as you describe above. You'll need to look into what the encoding is, and figure it out from there= . ChrisA