Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'try:': 0.07; 'subject:How': 0.09; 'python': 0.09; 'subject:()': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'aug': 0.13; '329': 0.16; 'decode': 0.16; 'subject:unicode': 0.16; 'subject:variable': 0.16; 'string': 0.17; 'wrote:': 0.17; 'byte': 0.17; 'unicode': 0.17; '>>>': 0.18; 'paul': 0.24; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'writes:': 0.29; 'skip:( 40': 0.30; 'print': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'method': 0.36; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'back': 0.62; 'subject:value': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=heOJh+8wEljXkQxyn4BXv+BpXiq5x0e5UQPikuPDEGM=; b=fJTnn2yjxtDhlVeC6PP/VvdAdBjRHOpVriY6Vr1yMG2rL9Am1sjpwUu7EO9wciIMPC yeYyHrjjEMaU4l0m9q8nBCt7E0LqakBvl/S8aGB9A9dYfv7qJgGynsYH+/lKTFMoEPiq zVQpD5Qzu7vjh7K7L2cr+6P4rCXg0xuPM8yoLGU5R9ry/5LTMfHYSFCL+ustK1NtgcFQ ZvhCClZ1fIf2DI6m0jtLMeijVpPrKz9xiQxywi4HAVZ0J5szb+B09mNYfnCm9Hz8Kkvz 2voSwB54RUjy6IIQ4Of1DRKtKSl93zwZVvvwEclFgO6v62LUGr27pG+wXlntOCFuPc0Z J8dA== MIME-Version: 1.0 In-Reply-To: <7xobm6u4kk.fsf@ruckus.brouhaha.com> References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <503088b7$0$29978$c3e8da3$5496439d@news.astraweb.com> <7xobm6u4kk.fsf@ruckus.brouhaha.com> From: Ian Kelly Date: Sun, 19 Aug 2012 12:31:09 -0600 Subject: Re: How do I display unicode value stored in a string variable using ord() To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345401102 news.xs4all.nl 6990 [2001:888:2000:d::a6]:52372 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27419 On Sun, Aug 19, 2012 at 12:20 PM, Paul Rubin wrote: > Ian Kelly writes: >>>>> sys.getsizeof(bytes(range(256)).decode('latin1')) >> 329 > > Please try: > > print (type(bytes(range(256)).decode('latin1'))) > > to make sure that what comes back is actually a unicode string rather > than a byte string. As I understand it, the decode method never returns a byte string in Python 3, but if you insist: >>> print (type(bytes(range(256)).decode('latin1')))