Given a filename or a readable file-like object, return a context manager that yields a readable file-like object.
This supports passing filenames, URLs, and readable file-like objects, any of which can be compressed in gzip or bzip2.
Parameters: | name_or_obj : str or file-like object
encoding : str, optional
cache : bool, optional
show_progress : bool, optional
remote_timeout : float
|
---|---|
Returns: | file : readable file-like object |
Notes
This function is a context manager, and should be used for example as:
with get_readable_fileobj('file.dat') as f:
contents = f.read()