I have a script which fetches a production site directly from a
Subversion repo using svn export
It runs a bunch of commands by calling this little method ...
def trycmd(cmd, log):
retcode = -1
ret = f"Trying {cmd}"
try:
retcode = os.system(cmd)
ret = f"\n{cmd} -ok->
On Tue, 29 Nov 2022 at 12:37, Loris Bennett wrote:
>
> Mats Wichmann writes:
>
> > On 11/27/22 16:40, Skip Montanaro wrote:
> >> I have a script to which I'd like to add a --version flag. It should print
> >> the version number then exit, much in the same way --help prints the help
> >> text then
On Sun, 27 Nov 2022 22:23:16 -0600, Karen Park declaimed
the following:
>I figured it out…there was a logistics file given with the assignment! I
>thought it was supposed to be a download included with the python
>download…oops!
>
I think you made this response in the wrong thread...
May python failed to install
--
https://mail.python.org/mailman/listinfo/python-list
Mats Wichmann writes:
> On 11/27/22 16:40, Skip Montanaro wrote:
>> I have a script to which I'd like to add a --version flag. It should print
>> the version number then exit, much in the same way --help prints the help
>> text then exits. I haven't been able to figure that out. I always get a
>>
Thanks. It occurs to me that instead of providing two special actions
("help" and "version"), it might be worthwhile to provide a standard way of
saying, "if present, process this option and exit before considering other
details of the command line." Matt's example action works well enough for
my n
More better:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("positional",type=int)
parser.add_argument('--version',action="version",version="2.0")
args = parser.parse_args()
# double argument
print(args.positional * 2)
From: Python-list on
behalf of Weatherby,Gerard