Skip to content

Instantly share code, notes, and snippets.

@alijnclarke
Created December 1, 2012 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alijnclarke/4180190 to your computer and use it in GitHub Desktop.
Save alijnclarke/4180190 to your computer and use it in GitHub Desktop.
COMP2740 - Filename module for quakes.py. Generates dynamic filename based on cmd arguments.
def filename(type):
''' Function to generate the correct name for the two files outputted by quakes.py
this function takes the parameter type as the identifier for the output required '''
global name
if type == "write":
name = 'quakes-' + str(sys.argv[1] + '-' + str(sys.argv[2]) + '.loc') #Concatinates string
elif type == "html":
name = 'quakes-' + str(sys.argv[1] + '-' + str(sys.argv[2]) + '.html')
return name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment