Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56259
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| 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; 'skip:u 30': 0.07; 'string': 0.09; 'ascii': 0.09; 'newline': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; '255': 0.16; 'hex': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'translators': 0.16; 'fix': 0.17; 'wrote:': 0.18; '>>>': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; 'header:X-Complaints-To:1': 0.27; 'getting': 0.31; 'lines': 0.31; '"",': 0.31; 'ball': 0.31; 'strip': 0.31; 'file': 0.32; '(most': 0.33; 'could': 0.34; 'skip:s 30': 0.35; 'convert': 0.35; 'but': 0.35; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'read': 0.60; 'email addr:gmail.com': 0.63; 'line,': 0.68; 'online': 0.71 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Odd-length string |
| Date | Sun, 06 Oct 2013 16:31:11 +0200 |
| Organization | None |
| References | <0f1b6cd6-3025-4bdc-8f80-73a51a7ed241@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Gmane-NNTP-Posting-Host | p50849e31.dip0.t-ipconnect.de |
| User-Agent | KNode/4.7.3 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.783.1381069884.18130.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381069884 news.xs4all.nl 15968 [2001:888:2000:d::a6]:57525 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56259 |
Show key headers only | View raw
markotaht@gmail.com wrote:
> print("Key-" + str(võti) + ": " + str(unhexlify("".join(tulemus))))
>
> IM getting this error on this line. This is the print line of a decryption
> program. I wanti it to convert the tulemus which is in HEX to ASCII so i
> could read it. I could use online translators for the line, but since i
> have 255 lines of the HEX codes, it would be higly unefficient.
>
> How to i fix the Oddlenght string?
My crystal ball says: strip off the newline byte:
>>> unhexlify(tulemus)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
binascii.Error: Odd-length string
>>> unhexlify(tulemus.rstrip(b"\n"))
b'whatever'
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Odd-length string markotaht@gmail.com - 2013-10-06 06:10 -0700
Re: Odd-length string Roy Smith <roy@panix.com> - 2013-10-06 09:46 -0400
Re: Odd-length string Peter Otten <__peter__@web.de> - 2013-10-06 16:31 +0200
Re: Odd-length string markotaht@gmail.com - 2013-10-06 07:37 -0700
Re: Odd-length string Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-06 15:56 +0100
Re: Odd-length string Terry Reedy <tjreedy@udel.edu> - 2013-10-06 15:50 -0400
Re: Odd-length string Piet van Oostrum <piet@vanoostrum.org> - 2013-10-06 20:59 -0400
csiph-web