pynxxas.io.utils.read_textfile#
- pynxxas.io.utils.read_textfile(filename, size=None)[source]#
read text from a file as string
filename (str or file): name of file to read or file-like object size (int or None): number of bytes to read
text of file as string.
the encoding is detected with charset_normalizer.from_bytes which is then used to decode bytes read from file.
line endings are normalized to be ‘
- ‘, so that
splitting on ‘
- ‘ will give a list of lines.
if filename is given, it can be a gzip-compressed file