擅长:python、mysql、java
<p><a href="https://stackoverflow.com/questions/11059390/parsing-a-tab-separated-file-in-python">Parsing Tab Delimited</a></p>
<p>阅读上面的这篇文章。它涵盖了使用pythonscsv模块解析制表符分隔符。我想这对你有帮助。在</p>
<p><strong>输入文件数据_帧.txt</strong></p>
<pre><code>5blue 2green5 white
white green\twhite3\t3blue5
blue3 white
7blue green2
3green 3white6
6blue green\t6white7 green
5blue5 6green white
</code></pre>
<p>下面的代码</p>
^{pr2}$
<p>这个代码应该可以工作。。。您只需将输出矩阵输出到csv文件。在</p>
<p><strong>输出</strong></p>
<pre><code>[1, 1, 1]
[0, 1, 3]
[1, 0, 1]
[1, 1, 0]
[0, 1, 1]
[1, 2, 1]
[1, 1, 1]
</code></pre>