Source From Here
Question
I am in need of a way to get the binary representation of a string in python. e.g.
Is there a module of some neat way of doing this?
How-To
You can leverage built-in functions ord, bytearray and format:
Question
I am in need of a way to get the binary representation of a string in python. e.g.
- st = "hello world"
- toBinary(st)
How-To
You can leverage built-in functions ord, bytearray and format:
沒有留言:
張貼留言