# Brought to you by: pythonprogramming.altervista.org from glob import glob def read_file(): "Show text file and ask user to choose 1 -> content as text" elenco = glob("*.txt") [print(n, x) for n, x in enumerate(elenco)] num = int(input("Quale scegli?\n")) with open(elenco[num], "r", encoding="utf-8") as file: file = file.read() return file print(read_file())
Twitter: @pythonprogrammi - python_pygame