I've been trying to use the linux shell to output a sequence of bytes into a file using Python. The problem is when I do:
python -c "print '\x11\x22\x33\x44'" > new_file
The new_file contains '\x11\x22\x33\x44\x0a'.
I looked up similar questions here on StackOverflow and tried to strip out the \x0a by the following and many other similar techniques:
python -c "print '\x11\x22\x33\x44'.rstrip('\x0a')" > new_file
The \x0a, however, refuses to go.
Has anyone run into this problem before? Would really appreciate a quick fix. Thanks.
PS: I've tried this with various versions of Python including 2.5, 2.7, 3.1, 3.3. All lead to the same problem.