On 10/6/2013 10:37 AM, markot...@gmail.com wrote:
NEw problem is : Traceback (most recent call last): File "C:\Users\Marko\Desktop\hacker.org\XOR cypher.py", line 35, in <module> print("Key-" + str(võti) + ": " + str("".join(tulemus2))) TypeError: sequence item 0: expected str instance, bytes found
If ''.join(iterable_of_strings) executes, the result is a string and str would not be needed. If you try
"".join(tulemus2) by itself, you will see the same error.
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']
Since tulemus2 is an iterable_of_bytes, you must join with bytes b'' and call str on the result. So just add the b prefix.
What Roy tried to say to you earlier is that when you get an error in a expression, and you do not understand *exactly* where in the expression the error is, pull the expression apart and test the pieces individually. This sometimes includes splitting
print(expression) # into s=expression print(s) -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list