Skip to content

Instantly share code, notes, and snippets.

@sadysnaat
sadysnaat / commandpromptinput.py
Created April 23, 2016 11:38
Use command prompt for user input
import os.path
# https://docs.python.org/2/library/functions.html#raw_input
report = raw_input("Please enter report location: ").strip()
# You can't always begin your programming flow with the
# input user has provided. It is better to check user input.
# In this case here is one useful check
if not os.path.isfile(report):
@sadysnaat
sadysnaat / cliargumentdemo.py
Created April 23, 2016 10:39
Use command line arguments in python script
import sys
# Read this
# https://docs.python.org/2/library/sys.html#sys.argv
# you can use
report = sys.argv[1]
# this way first argument that is passed
# to the script will be report location
# If you are further instersted you can use