User:Lagg/sebburger.py
Jump to navigation
Jump to search
# This is what you want to edit if you play around with the formatting, {0} is the name # {1} is the description. I poot little ASCII control characters too chieve_format = "\x1b[1m{0}\x1b[0m: {1}\r\n\r\n" import urllib2, sys from xml.etree import cElementTree achievement_page = cElementTree.parse(urllib2.urlopen("http://steamcommunity.com/id/stragglerastic/stats/Portal2?xml=1")) for chieve in achievement_page.find("achievements"): chieve_name = chieve.find("name").text.encode("utf-8") chieve_desc = chieve.find("description").text.encode("utf-8") sys.stdout.write(chieve_format.format(chieve_name, chieve_desc))