#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 17 16:24:09 2016 @author: andreaskuk @Matrikelnummer: 1525911 @Seminar: Wissenschaftliches Programmieren in Python """ import numpy as np mypath= 'imsil_out' from os import listdir onlyfiles= [f for f in listdir(mypath) if f.endswith('.out')] #suche datein mit der Endung .out im ordner mypath print('filelist: ',onlyfiles) f_1 = mypath+'/'+onlyfiles[0] #print(f_1) """f = open(f_1) f=f.read() search = 'tilt=' line = f.readline()""" searchfile = open(f_1, "r") for line in searchfile: if "tilt=" in line: print (line) searchfile.close() #print(f)