human
Give me a Python program to only list files with specific extension.
assistant
Here is a Python program to only list files with specific extension

import os

def _list_files_with_extension(extension):
    """
    List files with specific extension.
    """
    return [_f for _f in os.listdir('.') if _f.endswith(extension)]

# Enter the extension
extension = "txt"

# Calling the function
files = _list_files_with_extension(extension)

print(files)

#Example Output
# ['test.txt', 'C:\\Users\\carnation\\Desktop\\python_exercises\\file.txt', 'header.txt', 'log.txt']

#Remember to inspect code for bugs.