Python argparse 模块,open() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用argparse.open()

项目:nmtrain    作者:philip30    | 项目源码 | 文件源码
def __init__(self, codes, separator='@@'):            

        with codecs.open(codes.name, encoding='utf-8') as codes:
            self.bpe_codes = [tuple(item.split()) for item in codes]

        # some hacking to deal with duplicates (only consider first instance)
        self.bpe_codes = dict([(code,i) for (i,code) in reversed(list(enumerate(self.bpe_codes)))])

        self.separator = separator