path = '/home/mypath'
for filename in os.listdir(path):
    if re.match('text\\d+.txt', filename):
        with open(os.path.join(path, filename), 'r') as f:
            for line in f:
                pass
Open file by filename wildcard