【发布时间】:2019-03-11 10:38:06
【问题描述】:
我有一个这样的 data.txt
16.37.235.153|119.222.242.130|38673|161|17|62|4646|
16.37.235.153|119.222.242.112|56388|161|17|62|4646|
16.37.235.200|16.37.235.153|59009|514|17|143|21271|
我想得到一个包含表单的列表:
list=[['16.37.235.153','119.222.242.130',38673,161,17,62,4646]
['16.37.235.153','119.222.242.112',56388,161,17,62,4646]
['16.37.235.200','16.37.235.153',59009,514,17,143,21271]]
我尝试将 numpy.genfromtxt 与 dtype=None 一起使用,但后来我得到:
VisibleDeprecationWarning: Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default.
list = numpy.genfromtxt('results.rw', dtype=None, delimiter = '|')
这是列表:
[['8.254.200.14' 'False']
['8.254.200.14' 'False']
['8.254.200.46' 'False']
...
['217.243.224.144' 'False']
['217.243.224.144' 'False']
['217.243.224.144' 'False']]
感谢每一个帮助,在此先感谢您。
你好 :)
【问题讨论】:
标签: python list numpy types genfromtxt