binary

how to convert bytes to binary using python

how to convert bytes to binary using python Question: so i want convert bytes to binary in python, but when i run it, there’s none in the result and i got error: ‘NoneType’ object is not iterable here’s the code i tried //func biner def biner(password): print(password) password[0] for my_byte in password: print(f'{my_byte:0>8b}’, end=’ ‘) …

Total answers: 2

binary heap as tree structure searching algorithm

binary heap as tree structure searching algorithm Question: so i guess you are all fimilliar with a binary heap data structure if not.. Brilliant. org say i.e. a binary tree which obeys the property that the root of any tree is greater than or equal to (or smaller than or equal to) all its children …

Total answers: 2

Extracting data from binary file in python

Extracting data from binary file in python Question: I have an instrument (LumiCycle from Actimetrics) that records photon counts and writes binary (I think) files with all the data. It has a clunky software that allows you to manually read the file and export the data as .csv. I want to bypass the software with …

Total answers: 1

Base64 Binary String representation to float convertion

Base64 Binary String representation to float convertion Question: I did a lot of research and can’t seem to find the answer for this, e.g: link1 link2 So I have this base64 encoded string: BzM=, and I know that the correct value is 18.43 This value comes from a decimal field from a MySql database with …

Total answers: 1

Python3, binary data diffrent representation from what i need

Python3, binary data diffrent representation from what i need Question: I have to add an image to a database, so I open the image as binary and it stores it this way: b’x89PNGrnx1anx00x00x00rIHDRx00x00x00x01x00x00x00x01x01x03x00x00x00%xdbVxcax00x00x00x03PLTEx00x00x00xa7z=xdax00x00x00x01tRNSx00@xe6xd8fx00x00x00nIDATx08xd7c`x00x00x00x02x00x01xe2!xbc3x00x00x00x00IENDxaeB`x82′ However I need it to be strored this way: 0x89504e470d0a1a0a0000000d494844520000000100000001010300000025db56ca00000003504c5445000000a77a3dda0000000174524e530040e6d8660000000a4944415408d76360000000020001e221bc330000000049454e44ae426082 It is my first ever time working with binary files so there …

Total answers: 1

How to get back raw binary output from python fabric remote command?

How to get back raw binary output from python fabric remote command? Question: I am using Python 3.8.10 and fabric 2.7.0. I have a Connection to a remote host. I am executing a command such as follows: resObj = connection.run("cat /usr/bin/binaryFile") So in theory the bytes of /usr/bin/binaryFile are getting pumped into stdout but I …

Total answers: 1

Would anyone know the code in python that prints ONLY if it's a binary string?

Would anyone know the code in python that prints ONLY if it's a binary string? Question: The real problem is there: write a program that takes a string as input and prints “Binary Number” if the string contains only 0s or 1s. Otherwise, print “Not a Binary Number”. Asked By: FAOZIA ISLAM || Source Answers: …

Total answers: 3

Writing a "Chessboard" function in Python that prints out requested length of binary

Writing a "Chessboard" function in Python that prints out requested length of binary Question: I have an assignment for my Python course that I’m struggling with. We are supposed to make a function that prints out binary as follows: If the input is: chessboard(3) It should print out: 101 010 101 And so forth.. Its …

Total answers: 4

Function that converts a decimal to binary: how to return result instead of printing it?

Function that converts a decimal to binary: how to return result instead of printing it? Question: I need to write a function that converts an integer into binary. The function definition I have written so far is: def decimalToBinary(number): if number > 1: decimalToBinary(number//2) print(number % 2, end = ”) My problem is that: I …

Total answers: 2