Answers for "with open"

0

with open

with open('output.txt', 'w') as file:  # Use file to refer to the file object

    file.write('Hi there!')
Posted by: Guest on May-24-2020
0

with open

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')
Posted by: Guest on September-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language