string_fix#

astropop.py_utils.string_fix(string, encode='utf-8')#

Fix the byte<->string problem in python 3.

This method converts anything is passed to it into a string. If it is bytes also handle the decoding.

Parameters:
string: `str` or `bytes`

String to be checked or converted.

encode: string (optional)

Python compatible bytes like encoding. Default: ‘utf-8’

Returns:
string: str

The Python 3 string.