How to elegant grab data with python?
<p>I have data in text file and i need to store it in database and now i little bit confused how to do it easier.</p>

<p>Here is an example of my data:</p>

<pre><code>a: text1
b: text2
c: text3
blah blah not necessary text
a: text4
b: text5
c: text6
etc
</code></pre>

<p>So can you help me to parse this data. 
i already done next code</p>

<pre><code>import urllib2 as ur

def getPageData(url):
    return ur.urlopen(url).readlines()

checkList = ['a', 'b', 'c']

if __name__ == '__main__':
    textList = getPageData(url)
    res = []
    for i in textList:
        for y in checkList:
            if y in i:
                print i
</code></pre>

<p>I create a table in base something like </p>

<pre><code>id | a varchar | b varchar | c varchar |
</code></pre>

<p>and i expect next result</p>

<pre><code>id | a varchar | b varchar | c varchar |
1  | text1     | text2     | text3     |
2  | text4     | text5     | text6     |
n  | text      | text      | text      |
</code></pre>

<p>if read text file line by line how can i devide this text to logical blocks, for example i get a,b,c create dictinory with this data, and next when this block ends i append dictinary to list, and after that i have list of dict to store it to base. But i little bit confused how to create this list with this dictionary what i need to check and how to avoid unnecessary data in it? Is there more elegant way to do this?</p>

<p>Thanks</p>
