Sep-14-2021, 05:44 PM
(This post was last modified: Sep-14-2021, 05:45 PM by Axel_Erfurt.)
This is very different from the first post.
in_text = '''#EXTINF:137,Choir - When Johnny Comes Marching Home #EXTINF:191,Glenn Miller - When Johnny Comes Marching Home #EXTINF:308,Chad Mitchell Trio - Johnnie #EXTINF:205,Joan Baez - Johnny, I Hardly Knew Yeh #EXTINF:213,Clancy Brothers & Tommy Makem - Johnny I Hardly Knew You ''' for line in in_text.splitlines(): if line.startswith("#EXTINF"): print(line) name = line.split(",")[1] print(f'{name}.mp3')
Output:#EXTINF:137,Choir - When Johnny Comes Marching Home
Choir - When Johnny Comes Marching Home.mp3
#EXTINF:191,Glenn Miller - When Johnny Comes Marching Home
Glenn Miller - When Johnny Comes Marching Home.mp3
#EXTINF:308,Chad Mitchell Trio - Johnnie
Chad Mitchell Trio - Johnnie.mp3
#EXTINF:205,Joan Baez - Johnny, I Hardly Knew Yeh
Joan Baez - Johnny.mp3
#EXTINF:213,Clancy Brothers & Tommy Makem - Johnny I Hardly Knew You
Clancy Brothers & Tommy Makem - Johnny I Hardly Knew You.mp3