📜  打开 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:24.800000             🧑  作者: Mango

代码示例2
with open('songs.txt') as f,open('songs_out.txt', 'w') as f_out:
    for line in f:
        line = line.strip()
        if line.startswith("#EXTINF"):
            f_out.write(f'{line}\n')
            name = line.split(",")[1]
            f_out.write(f'{name}.mp3\n')