bit = "\xd8\xa3\xd9\x88\xd9\x87 \xd8\xa8\xd8\xaf\xd9\x8a\xd9\x84
\xd9\x85\xd9\x86 \xd9\x82\xd9\x88\xd9\x84\xd8\xaa\xd9\x8a
\xd9\x88\xd8\xa7\xd9\x87\xd8\xa7"
# here it is a byte but in str
encode_bit = bytes(bit , "latin-1") # i can here say to the computer it is
byte

#then it will print the same words in but byte
print(encode_bit)
decode = encode_bit.decode() # and i can then decode it and get what i want
print( decode )



bit = open("ss.txt","r")
bit = bit.read()
# but here i read the file and its hold the same bytes above
encode_bits = bytes(bit , "latin-1") # but here when i want to say it is
bytes it encode it so if it was /xa33 it will be //xa33
decode = encode_bits.decode()
# and when i decode it i get /xa33 not the same first one
print( decode)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MMHWLHWGMT6A6APMICYXJ3JQZIC5D2ZQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to