data_converter.py 文件源码

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

项目:AutoML5 作者: djajetic 项目源码 文件源码
def file_to_array (filename, verbose=False):
    ''' Converts a file to a list of list of STRING
    It differs from np.genfromtxt in that the number of columns doesn't need to be constant'''
    data =[]
    with open(filename, "r") as data_file:
        if verbose: print ("Reading {}...".format(filename))
        lines = data_file.readlines()
        if verbose: print ("Converting {} to correct array...".format(filename))
        data = [lines[i].strip().split() for i in range (len(lines))]
        del lines #djajetic 11.11.2015 questionable
    return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号