Skip to content

Instantly share code, notes, and snippets.

@zaxcie
Created June 2, 2018 17:23
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 zaxcie/82b16a5f5274b0c9f1c98145019d78fe to your computer and use it in GitHub Desktop.
Save zaxcie/82b16a5f5274b0c9f1c98145019d78fe to your computer and use it in GitHub Desktop.
Add variable to URL
def append_variable_to_url(URL, var_dict):
'''
Properly format string to append variable to URL
:param var_dict:
:return: URL variables string
'''
var_string = ""
for key in var_dict:
if var_string == "":
var_string = var_string + "?" + key + "=" + var_dict[key]
else:
var_string = var_string + "&" + key + "=" + var_dict[key]
return URL+var_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment