TersztyZsom / pokemon_api_sandbox

0 stars 0 forks source link

Hardcoding & command line input #3

Open bruce1971 opened 2 months ago

bruce1971 commented 2 months ago

I want you to have "type" as a command line input...

So when you run the code, the command line input should look something like... python script.py --type water

then the argument gets parsed in the script somehow like..

`import argparse

Create the parser

parser = argparse.ArgumentParser(description='Process some parameters.')

Add the --type argument

parser.add_argument('--type', type=str, help='Specify the type of action or item.')

Parse the arguments

args = parser.parse_args()

Access the --type argument

print(f"The specified type is: {args.type}")`

TersztyZsom commented 2 months ago

Hardcodedness fixed via your suggestion. Please check it, when you have time.