2012-07-26, 17:00
if i have repeated returns on a re.compile is there a way to ignore or only show one of the matched
i.e
will returns lots of matched songs
but will return
Walk Away (Kelly Clarkson)
Walk Away (Kelly Clarkson)
Walk Away (Kelly Clarkson)
Walk Away (Kelly Clarkson)
and i only want one
Walk Away (Kelly Clarkson)
obviously its not always the same song could be a different one
i.e
Code:
def ARTIST_SONG_INDEX(url):
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
match = re.compile('target="_self">(.+?)</a></td><td class="listing-col-artist"><a href=".+?" target="_self">(.+?)</a></td>').findall(link)
for name, url in match:
name = str(name).replace("'","'") .replace("&","and") .replace("ü","u") .replace(""","")
addDir(name,url,6,'http://live-tv-stream.googlecode.com/svn/Karaoke%20Icons/Main/SUNFLY.png')
will returns lots of matched songs
but will return
Walk Away (Kelly Clarkson)
Walk Away (Kelly Clarkson)
Walk Away (Kelly Clarkson)
Walk Away (Kelly Clarkson)
and i only want one
Walk Away (Kelly Clarkson)
obviously its not always the same song could be a different one