From 9484900f080e16f118806fe54973e69d36b043e8 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Mon, 11 Oct 2021 19:21:19 -0700 Subject: Adds logging in light stuff, minor changes in config/string. --- string_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'string_utils.py') 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' ) ) -- cgit v1.3