-1

I currently sitting on a macbook, and therefore i'm using Terminal. Anyway, I have created an adventure game in a file called adventure.py. The thing I want to do is to send a parameter to that file, for example:

  1. -h/ --help That explains what parameters that work
  2. -i/ --info Gives a description of the game
  3. -v/ --version Gives the version of the game
  4. -c/ --cheat Gives out cheats for the game or a explanation of how to complete the game as fast as possible.

What i'm guessing it that in terminal you write: adventure.py --version for example. But I dont know how to get started with this or how to even implement this. I've tried to google for an answer but havent found anything.

Thanks. :)

kreqq_
  • 43
  • 1
  • 9

1 Answers1

0

You can also try argparse - it's a Python package for doing exactly this. Examples, etc. are all in the documentation.

JoeG
  • 1