Since I am using a for loop to request a URL which changed with a constant number, how can I parsed the variable in?
total_page = 4
for y in range (total_page):
variable = 20*y+1
base_url = 'https://abcd.com/r='
url = ''.join([base_url, variable])
finviz1 = requests.get(url)
However, an error occurred
url = ''.join([base_url, variable])
TypeError: sequence item 1: expected string or Unicode, int found
How to eliminate the error?
variableis an integer, whilestring.joinexpects a list of strings. Convert variable to string byvariable = str(variable)