Skip to content

Instantly share code, notes, and snippets.

@chirag-v
Last active December 12, 2015 13:39
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 chirag-v/4780243 to your computer and use it in GitHub Desktop.
Save chirag-v/4780243 to your computer and use it in GitHub Desktop.
reading file old try/finally way
try:
f = open('/home/user/acetylene.xyz')
while True:
line = f.readline()
if len(line) == 0:
break
print(line, end=' ')
finally:
f.close()
print('file is closed now!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment