1
2
3 fl = raw_input("If you want to scan the file L5058011_01120090712_MTL.txt , type L5 and press enter! \n if you wish to scan any other file, enter the complete filename!")
4
5 print"\n\n\n"
6
7 print "you entered ", fl
8
9
10 print"\n\n\n"
11
12
13 if fl=="L5":
14 infile = open("L5058011_01120090712_MTL.txt","r")
15 else:
16 infile = open(fl,"r")
17
18
19
20 text = infile.readlines()
21 strt = raw_input("line starting with? ")
22
23 print"\n\n\n"
24 print "you entered ", strt
25 print"\n\n\n"
26 print "the following lines begin with",strt
27
28 for line in text:
29 line_stripped=line.strip()
30 if line_stripped.startswith(strt)==True:
31 print line
LehreWiki: OpenSource2010/Lesson4/Solution1 (last edited 2010-11-15 13:27:22 by nikolauskoopmann)