To read arguments from the commandline, you can use argparse.
import argparse
#Define command line arguments
parser = argparse.ArgumentParser(description='Get Yelp reviews.')
parser.add_argument("-p", "--page", dest="page", required=True, help="the page to parse")
#parse command line arguments
args = parser.parse_args()
Your page name will now be in args.page
. In this example, you would run the script like this:
>python script.py -p dennys-san-jose-5
or
>python script.py --page dennys-san-jose-5
Edit:
If your don't need any fancy stuff, and just want the raw command line input (like in a program that only you will be using, no need to validate input, etc):
import sys print sys.argv
If you want to prompt the user for a page name as the program is running: Python: user input and commandline arguments