inp = """System MA
user id =  2084
username =  XYZ90
selection =  pnq
decimal =  6.000
Percentage =  19.1176470588 %
System NA
user id =  2086
username =  pron1
selection =  abc
decimal =  13.000
Percentage =  13.1147540984 %
System M
user id =  1664
username =  Chrisod
selection =  pleader
decimal =  15.000
Percentage =  16.091954023 %"""
inp = inp.split('\n\n')
rss_start = """<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
  <title>Your title</title>
  <link>http://yoursite.com</link>
  <description>Your discription</description>
"""
rss_end = """</channel>
</rss> """

def description(item):
    return item

def title(item):
    return item.split('\n')[0]

def link(item):
    return 'http://mysite.com/' + item.split('\n')[0]
rss_items = []
for counter, item in enumerate(inp):
    rss_items.append(
        """
  <item>
    <title>%s</title>
    <link>%s</link>
    <description>%s</description>
    <guid>counter</guid>
  </item>"""
         % (title(item), description(item), link(item)))
rss_output = rss_start + ''.join(rss_items) + rss_end
Generating simple RSS feed from parsed data