Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: "convert" string to bytes without changing data (encoding) Date: Wed, 28 Mar 2012 19:40:57 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 27 Message-ID: References: <9tg21lFmo3U1@mid.dfncis.de> <9tg4qoFbfpU1@mid.dfncis.de> <9th0u8Fuf2U1@mid.dfncis.de> <4f7357d5$0$29981$c3e8da3$5496439d@news.astraweb.com> NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1332963657 9972 64.122.56.22 (28 Mar 2012 19:40:57 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 28 Mar 2012 19:40:57 +0000 (UTC) User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:22309 On 2012-03-28, Steven D'Aprano wrote: > On Wed, 28 Mar 2012 19:43:36 +0200, Peter Daum wrote: > >> The longer story of my question is: I am new to python (obviously), and >> since I am not familiar with either one, I thought it would be advisory >> to go for python 3.x. The biggest problem that I am facing is, that I am >> often dealing with data, that is basically text, but it can contain >> 8-bit bytes. > > All bytes are 8-bit, at least on modern hardware. I think you have to > go back to the 1950s to find 10-bit or 12-bit machines. Well, on anything likely to run Python that's true. There are modern DSP-oriented CPUs where a byte is 16 or 32 bits (and so is an int and a long, and a float and a double). >> As it seems, this would be far easier with python 2.x. > > It only seems that way until you try. It's easy as long as you deal with nothing but ASCII and Latin-1. ;) -- Grant Edwards grant.b.edwards Yow! Somewhere in Tenafly, at New Jersey, a chiropractor gmail.com is viewing "Leave it to Beaver"!