Skip to content

Instantly share code, notes, and snippets.

@jtara1
Created August 12, 2020 23:49
Show Gist options
  • Save jtara1/900a580b362ea1c8b3b7019695e04519 to your computer and use it in GitHub Desktop.
Save jtara1/900a580b362ea1c8b3b7019695e04519 to your computer and use it in GitHub Desktop.
$ python3 - a b c
Python 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.argv
['-', 'a', 'b', 'c']
>>> sys.argv = [sys.argv[0]]
>>> sys.argv
['-']
>>> # sys.argv[0] would normally be the name of the file being run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment