diff options
| author | Scott Gasch <[email protected]> | 2021-10-11 19:21:19 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-10-11 19:21:19 -0700 |
| commit | 9484900f080e16f118806fe54973e69d36b043e8 (patch) | |
| tree | 63ccd29bf087f90ceed97f0872d92ec167a95e6f /string_utils.py | |
| parent | a5c4feeac240a446a38147130b51ad96a046f6e1 (diff) | |
Adds logging in light stuff, minor changes in config/string.
Diffstat (limited to 'string_utils.py')
| -rw-r--r-- | string_utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/string_utils.py b/string_utils.py index 623ae45..a6a2da3 100644 --- a/string_utils.py +++ b/string_utils.py @@ -1461,10 +1461,14 @@ def to_bitstring(txt: str, *, delimiter='', encoding='utf-8', errors='surrogatep >>> to_bitstring('test', delimiter=' ') '01110100 01100101 01110011 01110100' + >>> to_bitstring(b'test') + '01110100011001010111001101110100' + """ + etxt = to_ascii(txt) bits = bin( int.from_bytes( - txt.encode(encoding, errors), + etxt, 'big' ) ) |
