provide a parameter to suppress printing a new line at the end of the bytes
provide a parameter to suppress printing a new line at the end of the bytes.
existing behavior is not changed.
@@ -45,7 +45,7 @@ def detect_language(candidates, pid):
FILESYSTEMENCODING = sys.getfilesystemencoding()
-def printb(s, file=sys.stdout):
+def printb(s, file=sys.stdout, nl=1):
"""
printb(s)
@@ -54,6 +54,7 @@ def printb(s, file=sys.stdout):
buf = file.buffer if hasattr(file, "buffer") else file
buf.write(s)
+ if nl:
buf.write(b"\n")
file.flush()
