How to get the next token (int, float or string) from a file in Python?
<p>Is there some way to just get the next token from a file in Python, as for example the Scanner class does in Java?</p>

<pre><code>File file = new File("something");
Scanner in = new Scanner(file);
double a = in.nextDouble();
String s = in.next();
</code></pre>

<p>I'd like to ignore whitespaces, tabs, newlines and just get the next int/float/word from the file. I know I could read the lines and build something like Scanner myself, but I'd like to know if there isn't already something that I could use.</p>

<p>I've searched around but could only find line-oriented methods.</p>

<p>Thank you!</p>
