Really quick question, if I want to return the data that is returned by snesVar in videoGame as a string on every line, what is the correct code to use?

def videoGame():
    count = 0 
    snesVar = []
    for data in os.listdir('/SNES/SNES Roms'):
        if data.endswith('.src') or data.endswith('.srm'):
    return snesVar

def videoGame2():
    gbaVar = []
    count = 0 
    for data in os.listdir('GBA'):
        if data.endswith('.gba') or data.endswith('.gb'):
    return gbaVar

def videoGame3():
    ndsVar = []
    count = 0 
    for data in os.listdir('NDS'):
        if data.endswith('.nds') or data.endswith('.ds'):
    return ndsVar

Your functions are duplicates, you only need one to return the file names. I do not understand your question.

def video_game(game_dir='/SNES/SNES Roms', extensions=('.src','srm')):
    return [file_name for file_name in os.listdir(game_dir) if data.endswith(extensions)]
This question has already been answered. Start a new discussion instead.