def read_resource(package, fname):
"""Read the given resource file and return content as string.
Parameters
----------
package : string
the package name.
fname : string
the resource file name.
Returns
-------
content : unicode
the content as a unicode string.
"""
raw_content = pkg_resources.resource_string(package, fname)
return raw_content.decode(encoding=bag_encoding, errors=bag_codec_error)
评论列表
文章目录