Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46417

Re: python b'...' notation

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!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'steve': 0.09; 'cc:addr :python-list': 0.11; 'character.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'hex': 0.16; 'insofar': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'notation': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'subject:python': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; 'cc:2**0': 0.24; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'rest': 0.29; "skip:' 10": 0.31; 'continues': 0.31; 'except': 0.35; 'received:com.au': 0.36; 'charset:us-ascii': 0.36; 'displays': 0.38; 'received:211': 0.38; 'pm,': 0.38; 'how': 0.40; 'ian': 0.60; 'content-disposition:inline': 0.62; 'to:addr:gmail.com': 0.65; '2013': 0.98
Date Thu, 30 May 2013 08:19:42 +1000
From Cameron Simpson <cs@zip.com.au>
To Ian Kelly <ian.g.kelly@gmail.com>
Subject Re: python b'...' notation
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <CALwzid=mdbD5n2-08uAsD5eRub3FadEOBYVS4NWmCQy7W+-XXQ@mail.gmail.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <CALwzid=mdbD5n2-08uAsD5eRub3FadEOBYVS4NWmCQy7W+-XXQ@mail.gmail.com>
X-Optus-CM-Score 0
X-Optus-CM-Analysis v=2.0 cv=e4Ne0tV/ c=1 sm=1 a=wom5GMh1gUkA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=Nu2K-ANblZgA:10 a=pGLkceISAAAA:8 a=gThQj61ffSHIMqGZva8A:9 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=nwh-WkCfU5YA:10 a=ChdAjXE5lkUvdteQbhpnkQ==:117
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2384.1369866008.3114.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369866008 news.xs4all.nl 15980 [2001:888:2000:d::a6]:42918
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46417

Show key headers only | View raw


On 29May2013 13:14, Ian Kelly <ian.g.kelly@gmail.com> wrote:
| On Wed, May 29, 2013 at 12:33 PM, alcyon <steve@terrafirma.us> wrote:
| > This notation displays hex values except when they are 'printable', in which case it displays that printable character.  How do I get it to force hex for all bytes?  Thanks, Steve
| 
| Is this what you want?
| 
| >>> ''.join('%02x' % x for x in b'hello world')
| '68656c6c6f20776f726c64'

Not to forget binascii.hexlify.
-- 
Cameron Simpson <cs@zip.com.au>

Every particle continues in its state of rest or uniform motion in a straight
line except insofar as it doesn't.      - Sir Arther Eddington

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: python b'...' notation Cameron Simpson <cs@zip.com.au> - 2013-05-30 08:19 +1000
  Re: python b'...' notation alcyon <steve@terrafirma.us> - 2013-05-30 15:19 -0700
    Re: python b'...' notation jmfauth <wxjmfauth@gmail.com> - 2013-05-31 00:51 -0700

csiph-web