Mengubah format saat membaca dari file teks

with open("videos.txt") as f:
    lines = [l.strip() for l in f.readlines()]

available_videos = ""
for line in lines:
    title, video, tags = [x.strip() for x in line.split("|")]
    available_videos += f"{title} ({video}) [{tags}]\n"

>>> print(available_videos)
Funny Dogs (funny_dogs_video_id) [#dog , #animal]
Amazing Cats (amazing_cats_video_id) [#cat , #animal]
Another Cat Video (another_cat_video_id) [#cat , #animal]
Life at Google (life_at_google_video_id) [#google , #career]
Video about nothing (nothing_video_id) []
Awful Armadillo