Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'string': 0.09; 'ascii': 0.09; 'assuming': 0.09; 'translate': 0.10; 'python': 0.11; "(i'm": 0.16; 'command.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'hex': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'command': 0.22; 'header:User-Agent:1': 0.23; 'bytes': 0.24; 'instance,': 0.24; 'instead.': 0.24; 'rid': 0.24; 'unicode': 0.24; 'sort': 0.25; 'skip:" 30': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'mix': 0.30; 'lines': 0.31; 'anyone': 0.31; 'file': 0.32; '(most': 0.33; 'guess': 0.33; 'sense': 0.34; 'problem': 0.35; "can't": 0.35; 'received:84': 0.35; 'format.': 0.36; 'sequence': 0.36; 'list': 0.37; 'expected': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; "you're": 0.61; 'email addr:gmail.com': 0.63; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:python.org': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=PIY2p5aC c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=LqG8EI-UCiYA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=HOtHEPtDfMMA:10 a=pGLkceISAAAA:8 a=-Zq6a4DUAAAA:8 a=GB7KC8SvYO3w3Q6PBPsA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=BFXbo9lxUkoA:10 X-AUTH: mrabarnett:2500 Date: Sun, 06 Oct 2013 20:36:47 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: HEX to ASCII References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381088197 news.xs4all.nl 15936 [2001:888:2000:d::a6]:43964 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56279 On 06/10/2013 20:07, markotaht@gmail.com wrote: > problem is : Traceback (most recent call last): > File "C:\Users\Marko\Desktop\hacker.org\XOR cypher.py", line 35, in > print("Key-" + str(vőti) + ": " + str("".join(tulemus2))) > TypeError: sequence item 0: expected str instance, bytes found > > If i take away the join command i get this: > Key-00000000: [b'u', b'o', b'\x00', b'\x1d', b' ', b'|', b'N', b'\x0f', b'9', b'j', b'K', b'J', b'&', b'#', b'A', b'K', b'5', b'k', b'_', b'\x1e', b',', b'j', b'\x0c', b'\x08', b'i', b'(', b'\x06', b'\\', b'r', b'3', b'\x1f', b'V', b's', b'9', b'\x1d'] > > the Key-00000000 is the key im using to decrypt the code. everything else is generated by the decrytion process and the unhexlify command. So my guess is, the join command cant handle the b"u" type of format. how can i get rid of the b. > > Or does anyone have a better idea how to translate HEX into ASCII and sort out the lines that make sense > (I'm assuming you're using Python 3) tulemus2 is a list of bytestrings (bytes), "" is a Unicode string (str). You can't mix them. Try b"".join(tulemus2) instead.