#!/usr/bin/env python3 # -*- coding: utf-8 -*- def numword2int(text): # beim replace Ersetzung mit zahl, anfangs und endbuchstabe, da wörter teilweise überlappen text = text.replace("one", "o1e").replace("two", "t2o").replace("three", "t3e").replace("four", "f4r") text = text.replace("five", "f5e").replace("six", "s6x").replace("seven", "s7n").replace("eight", "e8t") text = text.replace("nine", "n9e") return text input_file = open("input-org", "r") summe = 0 for line in input_file: v1, v2 = "", "" line = numword2int(line.strip()) for b in line: if b.isdigit() and v1 == "": v1 = b if b.isdigit() and v1 != "": v2 = b summe += int(v1+v2) input_file.close() print(summe)