file_name = "woerterbuch.txt" text = [] try: fh = open(file_name, 'r') except IOError: print("ERROR: cannot open", file_name) else: text = fh.readlines() print("OK", text) fh.close()