I am new to Python and would like to reproduce the convenience that I used when working in Perl. When calling a Perl script, I usually set $ ENV variables (e.g. VERBOSE, DEVELOP and DEBUG). Inside the called script, I restore their values ββusing
my $verbose=$ENV{VERBOSE}; my $develop=$ENV{DEVELOP}; my $debug=$ENV{DEBUG};
This allows you to print stmts conditionally for these variables.
Can I do the same in Python? I know thanks to the previous answers (thanks!) To use os.environ [var] in the script to access the values. But I could not understand how to assign a value to a variable when I call a script from the command line, as I could when a callinbg Perl script
Can I set values ββfor such variables on the command line that invokes the python script?
TIA
python
bobox
source share