eurovision.py 文件源码

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

项目:eurovision-country-selector 作者: mikejarrett 项目源码 文件源码
def get_countries_from_csv(filepath):
    """ Process a csv countaining country data.

    Args:
        filepath (str): A path to a csv file.

    Returns:
        list: sanitized country names as strings.

    Raises:
        OSError: If file does not exist at the filepath.
    """
    if not path.exists(filepath):
        raise OSError('Path to file: "{}" does not exist.'.format(filepath))

    with open(filepath, 'r') as csv_file:
        reader = csv.reader(csv_file)
        return [sanitize_string(''.join(row)) for row in reader]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号