Skip to content

Instantly share code, notes, and snippets.

@ghost355
Last active June 5, 2016 08:06
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 ghost355/4d3b95ab50d5754e39143e4f9d111306 to your computer and use it in GitHub Desktop.
Save ghost355/4d3b95ab50d5754e39143e4f9d111306 to your computer and use it in GitHub Desktop.
def arg_process():
for arg in sys.argv[1:]:
if arg in ["-h", "--help"]:
print("usage:csv2html.py [maxwidth=int] [format=str] < infile.csv > outfile.html")
return None, None
elif arg.startswith(maxwidth_arg):
try:
maxwidth = int(arg[len(maxwidth_arg):])
except ValueError:
pass
elif arg.startswith(format_arg):
format = arg[len(format_arg):]
return maxwidth, format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment