> I am not sure how to answer that question because all files are binary, > but the files that I will parse have an encoding that allows them to be > read in a non-binary output. But my program will not use the in a > non-binary way, that is why I plan to open them with the 'b' mode to > open them as binary with no encoding assumed by python. I just not have > tested this new technique that you gave me on a binary file yet as I was > still implementing it for strings.
As far as I know, even in binary mode, python will convert the binary data to read and write strings. So there is no reason this technique would not work for binary. Note, I was able to use the string representation of a PDF file to write another PDF file. So you do not need to worry about the conversion of binary to strings. All you need to do is convert the string to int, encrypt, decrypt, convert back to string, and write out again. Note Python3 being Unicode might change things a bit. Not sure if you will need to convert to bytes or some_string.decode('ascii'). Now if you end up needing to handle non-ASCII data, then this exercise gets more complicated. Not sure if a simple way to convert all characters to a numerical point, but it should still be possible. If your data is binary, then I do not think you will run into any issues. Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor