Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created November 18, 2013 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haya14busa/7526545 to your computer and use it in GitHub Desktop.
Save haya14busa/7526545 to your computer and use it in GitHub Desktop.
def readFile(filename, line=0):
f = open(filename, 'r')
try:
if line == 1:
return f.readline()
else:
return f.read()
finally:
f.close()
def writeFile(filename, content):
f = open(filename, 'w')
try:
f.write(content)
finally:
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment