setup.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:mssqlcli 作者: rtrox 项目源码 文件源码
def read(*filenames, **kwargs):
    """
    Read file contents into string.

    Used by setup.py to concatenate long_description.

    :param string filenames: Files to be read and concatenated.
    :rtype: string

    """
    encoding = kwargs.get('encoding', 'utf-8')
    sep = kwargs.get('sep', '\n')
    buf = []
    for filename in filenames:
        if path.splitext(filename)[1] == ".md":
            try:
                import pypandoc
                buf.append(pypandoc.convert_file(filename, 'rst'))
                continue
            except:
                with io.open(filename, encoding=encoding) as f:
                    buf.append(f.read())
        with io.open(filename, encoding=encoding) as f:
            buf.append(f.read())
    return sep.join(buf)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号