<div dir="ltr"><div><div><div><div>Hi All,<br><br>Please accept my apologies, if this similar question has been asked earlier, I tried to search over the stack network and googled but couldn't find relevant information, partly may be because I may not be able to search effectively. <br><br>I have built a contact form which sends me email for every user registration My question is more related to parsing some text data into csv format. and I have received multiple users information in my mail box which I had copied into a text file. The data looks like below.<br><br>    Name: testuser2<br>    Email: <a href="mailto:testuser2@gmail.com">testuser2@gmail.com</a><br>    Cluster Name: o  b<br>    Contact No.: 12346971239<br>    Coming: Yes<br><br>    Name: testuser3<br>    Email: <a href="mailto:testuser3@gmail.com">testuser3@gmail.com</a><br>    Cluster Name: Mediternea<br>    Contact No.: 9121319107<br>    Coming: Yes<br><br>    Name: testuser4<br>    Email: <a href="mailto:tuser4@yahoo.com">tuser4@yahoo.com</a><br>    Cluster Name: Mediterranea<br>    Contact No.: 7892174896<br>    Coming: Yes<br><br>    Name: tuser5<br>    Email: <a href="mailto:tuserner5@gmail.com">tuserner5@gmail.com</a><br>    Cluster Name: River Retreat A<br>    Contact No.: 7583450912<br>    Coming: Yes<br>    Members Participating: 2<br><br>    Name: Test User<br>    Email: <a href="mailto:testuser@yahoo.co.in">testuser@yahoo.co.in</a><br>    Cluster Name: RD<br>    Contact No.: 09833123445<br>    Coming: Yes<br>    Members Participating: 2<br><br><br>As can see the data contains some common fields and some fields which are not present, I am looking for solution/suggestion on how I can parse this data so under the heading Name, I will collect the name information under that column, and similarly for other, the data with title "Members Participating" I can just pick the nos and add it into excel sheet under the same heading, incase for the user this information is not present, it can just go blank.<br><br></div>Stackoverflow link to this question: <a href="http://stackoverflow.com/questions/31911191/parsing-data-from-text-file-to-python">http://stackoverflow.com/questions/31911191/parsing-data-from-text-file-to-python</a><br><br><br></div>Regards,<br></div>Om Prakash Singh<br></div>Live Curious<br></div>