Unable to extract information from Linux shell command using python
<p>I am creating a Python script to collect data on underlying hardware from <code>cat /proc/cpuinfo</code>
I am trying to extract information i need. But I am having a problem. Here is the script</p>

<pre><code>import os
p=os.popen ("cat /proc/cpuinfo")
string=[]
i=0
for line in p.readlines():
   string.append(line.split(":"))
   if(string[i][0]=='model name'): 
        fout = open("information.txt", "w")
        fout.write("processor:")
        fout.write(string[i][1])
        fout.close()
   i+=1
</code></pre>

<p>My program does not enter if loop at all why? Thanks in advance for help</p>
