Write a python code that lists all audio files in a directory in seconds.
Here's a python code that lists all audio files in a directory and displays their length in seconds:

import os
import wave
import contextlib

def get_audio_duration(filename):
    with contextlib.closing(wave.open(filename, 'r')) as f:
        frames = f.getnframes()
        rate = f.getframerate()
        duration = frames / float(rate)
        return duration

directory = '/path/to/your/directory'
for filename in os.listdir(directory):
    if filename.endswith(.wav) or filename.endswith(.mp3):
        filepath = os.path.join(directory, filename)
        duration = get_audio_duration(filepath)
        print(f{filename}: {duration:.2f} seconds)

This code loops through all the files in the directory and prints the filename and its duration for audio files with the .wav or .mp3 extension.
I get an error when I have mp3 files but it works for wav files. Can you make it work for mp3 files too?