import urllib,re,sys; from BeautifulSoup import BeautifulSoup inp = str(sys.argv[1]) a = urllib.urlopen("http://www.azlyrics.com/lyrics/" + inp + ".html").read() soup = BeautifulSoup(a) b = soup.findAll(style="margin-left:10px;margin-right:10px;") c = str(b).replace("[]", "") meta = inp.split("/") file = open(meta[0] + " - " + meta[1] + ".html", "w") file.write(c) file.close() print "Success. Lyrics written to " + file.name