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


Groups > comp.lang.python > #28205 > unrolled thread

Re: to know binary

Started byDave Angel <d@davea.name>
First post2012-09-01 01:29 -0400
Last post2012-09-01 01:29 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: to know binary Dave Angel <d@davea.name> - 2012-09-01 01:29 -0400

#28205 — Re: to know binary

FromDave Angel <d@davea.name>
Date2012-09-01 01:29 -0400
SubjectRe: to know binary
Message-ID<mailman.25.1346477391.27098.python-list@python.org>
On 09/01/2012 12:59 AM, contro opinion wrote:

1) you top-posted
2) you replied privately, excluding the list from your query

> the file is utf-8 format,
>>>> str='/0x31/0x32/0x33/0x34'

3) No idea what that value is supposed to mean.  Perhaps you intended to
use backslashes here?  And perhaps you meant to omit the zeroes?

>>>>
> why  unicode(str,"utf-8").encode("utf-8")  can not get  1234?
> 

It gets a string, not an integer.  And the string will be "1234" once
you fix the problems in the earlier line.

While you're at it, you should pick a better name for your string.  str
already has a meaning in Python, and you're hiding that.  No real harm
other than readability, but it'll be embarrassing when you actually need
to use the str() function and you end up trying to call your string.

Still not sure how to interpret your original message.  You said nothing
about unicode, or conversions.

And I've been assuming you're using Python 2.x, but all this will be
different for 3.x

-- 

DaveA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web