So, I wrote encrypted data to txt file.
And I read the line using readline()
.
But what I get is string type value.
In the text file, it looks like this:
`b'sc\x00\x01\x9eU\x86\x8aV\x8f\xa3\x9f\xf4iD\x9bv\xea\x05\x11\xdeo\xd7 \xef\xb1iK\xc1;\xa5\x02\x9fz@\xe4|\x9b^\xe5\xf9e\xc4\xf30\xaa\xe8\xcc>\xf8a\xfa;"\xfb)\xc7z|\xc9\x9c\x1c\x19\xc1}\x15\xdd_\xfd\x90z\x865\xe9O\xef\xd9\t\x06\x9c'`
(b'~~~~~~')
But, when I read the text file in python and put it in the variable, it looks like this:
'b\'sc\\x00\\x01\\x9eU\\x86\\x8aV\\x8f\\xa3\\x9f\\xf4iD\\x9bv\\xea\\x05\\x11\\xdeo\\xd7 \\xef\\xb1iK\\xc1;\\xa5\\x02\\x9fz@\\xe4|\\x9b^\\xe5\\xf9e\\xc4\\xf30\\xaa\\xe8\\xcc>\\xf8a\\xfa;"\\xfb)\\xc7z|\\xc9\\x9c\\x1c\\x19\\xc1}\\x15\\xdd_\\xfd\\x90z\\x865\\xe9O\\xef\\xd9\\t\\x06\\x9c\'\n'
('b\'~~~~~~\'\n')
Because of that difference, I get an error message:
you cannot use a string because no string encoding will accept all possible characters.
It recognizes that as a string.
How do I read from file and put it in the variable in bytes type?