Hi there, I am somewhat new to Python and I am writing a test that passes in URLs. I want to have a loop that will pass in different parameters. I cannot get past the error "TypeError: float argument required, not str"

What am I doing wrong?

url3 = "http://standardsService/Standards.svc/Standards()?$filter=Authority%20eq%20'%s'&$inlinecount=allpages"


for state in ['Arkansas','Alaska']:
    response3 = urllib2.urlopen(url3 % state)

print (response3.read())

Recommended Answers

All 2 Replies

The url3 has too many % signs. The %20e sequence tries to format an argument as a floating point into 20 characters.

Change stray %s into %%s: Authority%%20eq%%20'%s'&$inlinecount

Thank you so very much, I tried every variation besides that one. I have been banging my head on this one for about three days. This worked like a charm!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.