parsing out a second delimited data structure
<p>I am reading in a .csv file similar to the following.  Note that PhoneNumbers can contain multiple values delimited by the pipe character.</p>

<p>FirstName,LastName,PhoneNumbers<br>
Bucky,Fuller,213.283.5555|714.345.5566<br>
Stephen,Hawking,212.456.7897|312.345.6677|415.223.3423<br>
Robert,Heinlein,562.457.8899  </p>

<p>I am able to read in the .csv file and write out to a file using the following.</p>

<pre><code>.....
dReader = csv.DictReader(open('employee_import.csv', 'rb'), delimiter=',', quotechar='`')
for row in dReader:
file.write("\t\t\t&lt;PHONEBOOK&gt;\n")
file.write("\t\t\t\t&lt;LASTNAME&gt;"+str(row.get('LastName'))+"&lt;/LASTNAME&gt;\n")
file.write("\t\t\t\t&lt;FIRSTNAME&gt;"+str(row.get('FirstName'))+"&lt;/FIRSTNAME&gt;\n")
file.write("\t\t\t\t&lt;PHONENUM&gt;"+str(row.get('PhoneNumbers'))+"&lt;/PHONENUM&gt;\n")
    file.write("\t\t\t&lt;PHONEBOOK&gt;\n")
.....
</code></pre>

<p>I was wondering if anyone had any ideas how I could iterate through the PhoneNumbers Key,Value pair so that I can separate out the multiple PhoneNumbers a person can have?  Thank you.</p>
