Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Get Command Line Arguments In Python

Code

import sys 
  
  total_arguments = len(sys.argv)

  print(f"Number of arguments: {total_arguments}")
  print(f"Argument List: {sys.argv}")

#+RESULTS: : Number of arguments: 1 : Argument List: ['']

TODO: write up how the args work where the python executable is always in the first spot (and verify that's the case even if you call it with something like `bash -c`