test_io.py 文件源码

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

项目:deliver 作者: orchestor 项目源码 文件源码
def test_recfromtxt(self):
        with temppath(suffix='.txt') as path:
            path = Path(path)
            with path.open('w') as f:
                f.write(u'A,B\n0,1\n2,3')

            kwargs = dict(delimiter=",", missing_values="N/A", names=True)
            test = np.recfromtxt(path, **kwargs)
            control = np.array([(0, 1), (2, 3)],
                               dtype=[('A', np.int), ('B', np.int)])
            self.assertTrue(isinstance(test, np.recarray))
            assert_equal(test, control)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号