import argparse
import os
PATH_HOME = os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser(description="Purpose: my program")
parser.add_argument('--foo','-f',
type = str, # The type of argument input
nargs = '?', # Accepts 0 or 1 arguments
dest = 'file_name', # Parse_args property NAME
action = 'store', # Mode for default action
const = 'default2.txt', # Default value for the flag
required = False, # Whether are argument must be provided
default = 'default1.txt', # Default argument if no flags are present
help = 'path to file', # Help on this flag parameter
metavar = 'Path to this thing' # Used when -h is invoked
)
print(PATH_HOME)
print(parser.parse_args())
print(parser.parse_args().file_name)
print(parser.parse_args().file_name.split())
if _name_ == "__main__":
pass
DONATE:
---------------
PAT: / rezatahirkheli
PP: https://www.paypal.com/paypalme/rezat...
BTC: 3EUQBWZKX9Vcwdffd3cUGATQopxrAQQxJ9
LTC: MBXE6hJgxxFYSD8SjmR7sHCHGTqFXmNGoU
On this page of the site you can watch the video online Using Python's Argparse Flags: Automation Application with a duration of hours minute second in good quality, which was uploaded by the user ZeroLife 18 August 2022, share the link with friends and acquaintances, this video has already been watched 239 times on youtube and it was liked by 1 viewers. Enjoy your viewing!