0

Hey im trying to change 2 parts of a string, first is the last char, second in the mid of the string:

*nkw= will be cat: "sport , elec..."

*pgn= 1 , 2, 3, 4 ....

there is 2 loops because i want to run on the first cat , 1...n pages , than go ahead to the next cat - 1...n pages.

thanks!

url_template='https://www.ebay.com/sch/i.html?_nkw=&_pgn='
categories = ["Sport","Electronics","Fashion","Health"]

for cat in categories:
for count in range(0,2):
    url = url_template%(cat,count)
    print(url)
    products = get_index_data(get_page(url))

TypeError: not all arguments converted during string formatting *Also tryied: (cat,(str)count)

1 Answer 1

0

You need to use printf-style format strings for this. See the documentation for more information.

url_template='https://www.ebay.com/sch/i.html?_nkw=%s&_pgn=%d'

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.