Convert int to byte array
2015-03-25 20:48
387 查看
iLength # 32 bit integer data = array.array('B') data.append( ((iLength>>24)&0xFF) ) data.append( ((iLength>>16)&0xFF) ) data.append( ((iLength>>8)&0xFF) ) data.append( ((iLength)&0xFF) ) file_out.write( data )
-------------
Ref:http://stackoverflow.com/questions/16887493/write-a-binary-integer-or-string-to-a-file-in-python
相关文章推荐
- Convert an int to a byte array,Java Programming - integer to byte
- convert a byte array to a hexadecimal string
- Convert byte array to char* in a clr wrapper
- convert from to (byte [] array)
- Convert Document to ByteArrayInputStream
- Java: convert a file to a byte array, then convert byte array to a file.
- Android Bitmap convert to ByteArray
- convert an int into a byte array
- Convert a byte[] array to readable string format. This makes the "hex" readable!
- Java: How to convert int[] to byte[]
- org.apache.shiro.codec.CodecException: Unable to convert source [hello] to byte array using encoding
- Convert a string to a byte array and vica-versa in C#
- Convert a byte array to a Hex string
- How to convert array<System::Byte> to char* in C++ CLR?
- java int to byte array
- Type mismatch: cannot convert from int to byte
- Convert Sorted Array to Binary Search Tree --- LeetCode
- Convert Sorted Array to Binary Search Tree
- Convert Array to Hash while preserving Array index values in Ruby
- leetCode:Convert Sorted Array to Binary Search Tree