Numpy loadtxt: ValueError: Wrong number of columns
<p>Having the file TEST.txt structured as following:</p>

<pre><code>a   45
b   45  55
c   66
</code></pre>

<p>When I try to open it:</p>

<pre><code>import numpy as np
a= np.loadtxt(r'TEST.txt',delimiter='\t',dtype=str)
</code></pre>

<p>I have got the following error:</p>

<blockquote>
  <p>ValueError: Wrong number of columns at line 2</p>
</blockquote>

<p>It's clearly due to the fact that the second line has three columns instead of two, but I can't find an answer to my problem using the documentation.</p>

<p>Is there anyway I can fix it keeping all the data into an array?</p>

<p>In Matlab I can do something like:</p>

<pre><code>a=textscan(fopen('TEST.txt'),'%s%s%s');
</code></pre>

<p>Something similar in Python would be apreciated.</p>