report.py 文件源码

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

项目:maggma 作者: materialsproject 项目源码 文件源码
def sortby(self, name_or_index):
        name, index = None, None
        if isinstance(name_or_index, int):
            index = name_or_index
        else:
            name = name_or_index
        if name is not None:
            try:
                colnum = self._colnames.index(name)
            except ValueError:
                raise ValueError('column {} not in {}'.format(name, self._colnames))
        else:
            if index < 0 or index >= self._width:
                raise ValueError('index out of range 0..{:d}'.format(self._width - 1))
            colnum = index
        self._rows.sort(key=itemgetter(colnum))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号