[Solved] Extract a substring that starts with “http” and ends with “.mp3” from a string


You can use regular expressions for what you describe:

In [48]: s="Link: http://google.com/song.mp3 Another link, http://yahoo.com/another_song.mp3"

In [49]: re.findall('http.*?mp3', s)
Out[49]: ['http://google.com/song.mp3', 'http://yahoo.com/another_song.mp3']

1

solved Extract a substring that starts with “http” and ends with “.mp3” from a string