Open file and read to find first instance of number. Python
<p>Im stuck on a problem for an assignment, I need to write a program that opens a file on my computer, and scans that file for the first instance of a number. Once it is found it will return </p>

<p>The first number in , filenm is x</p>

<p>otherwise it will say there is no number in filenm.</p>

<p>My code so far is below:
When i run it no matter what it always says theres no number :(</p>

<pre><code>filenm = raw_input("Enter a file name: ")
datain=open(filenm,"r")

try:
    c=datain.read(1)
    result = []

    for line in datain:
        c=datain.read(1)

        while int(c) &gt;= 0:
            c = datain.read(1)
            result.append(c)


except:
    pass

    if len(result) &gt; 0:
            print "The first number is",(" ".join(result))+" . "
    else:
            print "There is no number in" , filenm + "."
</code></pre>
