Vcard parser with Python
<p>I am parsing my vcard info (copied to a txt file)to extract <code>name:number</code> and put it into a dictionary.</p>

<p>Data sample:</p>

<pre>
BEGIN:VCARD  
VERSION:2.1  
N:MEO;Apoio;;;  
FN:Apoio MEO  
TEL;CELL;PREF:1696  
TEL;CELL:162 00  
END:VCARD  
BEGIN:VCARD  
VERSION:2.1  
N:estrangeiro;Apoio MEO;no;;  
FN:Apoio MEO no estrangeiro  
TEL;CELL;PREF:+35196169000  
END:VCARD  
</pre>

<pre><code>import re
file = open('Contacts.txt', 'r')
contacts = dict()

    for line in file:
            name = re.findall('FN:(.*)', line)
            nm = ''.join(name)

            if len(nm) == 0:
                continue
            contacts[nm] = contacts.get(nm)
    print(contacts)
</code></pre>

<p>With this I am getting a dictionary with names but for numbers I am getting None. <code>{'name': None, 'name': None}</code>.</p>

<p>Can I do this with re? To extract both name and number with the same <code>re.findall</code> expression?</p>