title: How to convert .txt file into xml file using python?
body: <pre><code>Latitude :23.1100348
  Longitude:72.5364922
  date&amp;time :30:August:2014 05:04:31 PM
  gsm cell id: 4993
  Neighboring List- Lac : Cid : RSSI
  15000     :    7072     :    25 dBm
  15000     :    7073     :    23 dBm
  15000     :    6102     :    24 dBm
  15000     :    6101     :    24 dBm
  15000     :    6103     :    17 dBm
  
  Latitude :23.1120549
  Longitude:72.5397988
  date&amp;time :30:August:2014 05:04:34 PM
  gsm cell id: 4993
  Neighboring List- Lac : Cid : RSSI
  15000     :    7072     :    24 dBm
  15000     :    7073     :    22 dBm
  15000     :    6102     :    23 dBm
  15000     :    6101     :    23 dBm
  15000     :    2552     :    16 dBm
  </code></pre>
  
  <p>This is my.txt file I want convert it into xml file like</p>
  
  <pre><code>&lt;celldata&gt;
  &lt;time&gt;        &lt;/time&gt;
  &lt;latitude&gt;    &lt;/latitude&gt;
  &lt;longitude&gt;   &lt;/longitude&gt;
  
  &lt;/celldata&gt;
  </code></pre>
  
  <p>I tried to make list of all components but I didn't get o/p.I want to store all values of latitude,longitude,gsm cell id,time in list and this will add in xml file something like that.
  I write below code.</p>
  
  <pre><code>import re
  
  pa = 'Longitude|Latitude|gsm cell id|Neighboring List- Lac : Cid : RSSI'
  
  with open('cell.txt','rw') as file:
      for line in file:
          line.strip()    
          if re.search(pa, line):
              lineInfo = line.split(':')
              title = lineInfo[0]
              value = lineInfo[1]
  </code></pre>