citations.py 文件源码

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

项目:KDDCUP2016 作者: hugochan 项目源码 文件源码
def parse_cited_numeric(self, citation_str):

        cited = []

        citation_str = citation_str[1:-1]  # Remove surrounding brackets []
        cids = map(string.strip, citation_str.split(","))
        for cid in cids :

            # Check if the range kind of e.g. [1-4] or not
            if cid.find('-')<0 :
                cited.append(cid)
            else :
                start, end = cid.split('-')
                cited_range = range(int(start.strip()), int(end.strip())+1)
                cited.extend(map(str, cited_range))

        return cited
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号