index error:list out of range
<pre><code>from string import Template
from string import Formatter
import pickle
f=open("C:/begpython/text2.txt",'r')
p='C:/begpython/text2.txt'
f1=open("C:/begpython/text3.txt",'w')
m=[]
i=0
k='a'
while k is not '':
    k=f.readline()
    mi=k.split('  ')
    m=m+[mi]
    i=i+1

print m[1]

f1.write(str(m[3]))
f1.write(str(m[4]))

x=[]
j=0
while j&lt;i:
    k=j-1
    l=j+1
    if j==0 or j==i:
       j=j+1
    else:
        xj=[]
        xj=xj+[j]
        xj=xj+[m[j][2]]
        xj=xj+[m[k][2]]
        xj=xj+[m[l][2]]
        xj=xj+[p]
        x=x+[xj]
        j=j+1

f1.write(','.join(x))




f.close()
f1.close()
</code></pre>

<p>It say line 33,xj=xj+m[l][2]
has index error,list out of range</p>

<p>please help
 thanks in advance</p>
