how to create a list of lists

后端 未结 5 2088
孤独总比滥情好
孤独总比滥情好 2020-12-16 20:30

My Python code generates a list everytime it loops:

list = np.genfromtxt(\'temp.txt\', usecols=3, dtype=[(\'floatname\',\'float\')], skip_header=1)
         


        
5条回答
  •  醉话见心
    2020-12-16 20:55

    Use append method, eg:

    lst = []
    line = np.genfromtxt('temp.txt', usecols=3, dtype=[('floatname','float')], skip_header=1)
    lst.append(line)
    

提交回复
热议问题