strif icon indicating copy to clipboard operation
strif copied to clipboard

Tiny, useful Python lib for strings and files

Results 5 strif issues
Sort by recently updated
recently updated
newest added

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...

feature

Something like ``` def ensure_str(bytes_or_str, encoding=None): return bytes.decode(encoding) if type(bytes_or_str) is bytes else bytes_or_str ``` It doesn't seem like there's any single expression to do this normally. https://stackoverflow.com/questions/7585435/best-way-to-convert-string-to-bytes-in-python-3

feature

http://stackoverflow.com/questions/715417/converting-from-a-string-to-boolean-in-python Probably something like this is best, as it's strict but reasonable: ``` def parse_bool(val): if val in [True, 1, "True", "true"]: return True elif val in [False, 0, "False",...

This library has been tested reasonably well on Linux and MacOS, but not at all on Windows.

help wanted

See http://stackoverflow.com/questions/1158076/implement-touch-using-python