Skip to content

Instantly share code, notes, and snippets.

@syndbg
Last active August 29, 2015 14:07
Show Gist options
  • Save syndbg/7e32bb89040bc63f35aa to your computer and use it in GitHub Desktop.
Save syndbg/7e32bb89040bc63f35aa to your computer and use it in GitHub Desktop.
from sys import argv
def cat(filename):
file_contents = ''
try:
with open(filename, 'r') as f:
file_contents = f.read()
except FileNotFoundError:
return 'File {} not found.'.format(filename)
return file_contents
def main():
file_to_read = argv[1]
print(cat(file_to_read))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment