research-rainfallradar/aimodel/src/lib/io/readfile.py

9 lines
237 B
Python
Raw Normal View History

import io
from .handle_open import handle_open
def readfile(filepath, transparent_gzip=True):
2022-12-08 18:31:42 +00:00
handle = handle_open(filepath, "r") if transparent_gzip else io.open(filepath, "r")
content = handle.read()
handle.close()
return content