jlevy / jlevy/strif

print_raw function for writing bytes out on Python 3

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
131
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Often people print bytes out and it looks ugly in Python 3.

Convert something like this to handle raw writing in Python 3 and with a file= argument for multiple streams. Can fallback to regular print in Python 2.
```
def print_raw(bytes):
"""Print bytes, preserving binary chars for color/CURSES/etc on command line."""
sys.stdout.buffer.write(bytes)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.