Created
September 19, 2018 10:28
-
-
Save goddoe/4697a172aa37b8c0f41b549b248e9bae to your computer and use it in GitHub Desktop.
ipython script.py -- --argument blah
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
ou can use one -- more option before that: | |
ipython script.py -- --argument blah | |
Help of Ipython: | |
ipython [subcommand] [options] [-c cmd | -m mod | file] [--] [arg] ... | |
If invoked with no options, it executes the file and exits, passing the | |
remaining arguments to the script, just as if you had specified the same | |
command with python. You may need to specify `--` before args to be passed | |
to the script, to prevent IPython from attempting to parse them. If you | |
specify the option `-i` before the filename, it will enter an interactive | |
IPython session after running the script, rather than exiting. | |
Demo: | |
$ cat script.py | |
import sys | |
print(sys.argv) | |
$ ipython script.py -- --argument blah | |
['script.py', '--argument', 'blah'] | |
$ ipython script.py -- arg1 arg2 | |
['script.py', 'arg1', 'arg2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment