Last active
August 29, 2015 14:07
-
-
Save syndbg/7e32bb89040bc63f35aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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