Remove File.close() calls as they are not neccessary

This commit is contained in:
georgelinsdell 2017-12-20 16:32:16 +00:00
commit 3c0896f1ee

View file

@ -29,13 +29,11 @@ def main(argv):
with open(filetoconvert, 'x') as f:
with open(filecopy,'r') as c:
fileread = c.read()
c.close()
print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern))
converted = fileread.replace(pattern, substitute)
#print ("DEBUG: %s "%converted)
print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute))
f.write(converted)
f.close()
return 0