Skip to content

Instantly share code, notes, and snippets.

@funrep
Created November 4, 2012 13:07
Show Gist options
  • Save funrep/4011824 to your computer and use it in GitHub Desktop.
Save funrep/4011824 to your computer and use it in GitHub Desktop.
# this code:
import argparse
parser = argparse.ArgumentParser(prog='cat.py')
parser.add_argument('file', help='file to print and catenate')
main():
args = parser.parse_args()
file = open(args.file, 'r').read()
print file
if __name__ == '__main__':
main()
# gives me this error:
# $ ./cat.py
# File "./cat.py", line 14
# main():
# ^
# SyntaxError: invalid syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment