Created
June 2, 2018 17:23
-
-
Save zaxcie/82b16a5f5274b0c9f1c98145019d78fe to your computer and use it in GitHub Desktop.
Add variable to URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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