I have a line like this in my python script:
data = sys.stdin.read()
Then I run the script with file redirecting on Windows:
>> python test.py < binary_file
If binary_file contains \x1a
(ctrl-Z) that is EOF
in Windows, data will only have the string before \x1a
. I know this can be fixed with open("...", "rb")
for a regular file.
How would I handle this for sys.stdin
?