Skip to content

Commit

Permalink
excluded unnecessary reading of file twice
Browse files Browse the repository at this point in the history
  • Loading branch information
JaksaVucicevic committed Feb 21, 2012
1 parent 6c5520d commit 80052d5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ def CheckForN(line):
else :
return True

def FixFile(fname,i) :
F = open(fname)
lines = F.readlines()
F.close()
def FixFile(fname,lines,i) :
lines[i] = "Sex: M\n";
F = open(fname,'w')
for line in lines :
Expand All @@ -26,7 +23,7 @@ def FixFile(fname,i) :
for i in range(len(lines)):
if CheckForN(lines[i]) :
print Fname, lines[i]
FixFile(Fname,i)
FixFile(Fname,lines,i)
break
F.close()

Expand Down

0 comments on commit 80052d5

Please sign in to comment.