Reputation: 307
How do I pass the value of variable a
the below url after token:
a = 123
import urllib
testfile = urllib.URLopener()
testfile.retrieve("'https://test.test.com/comp/export?format=csv& 'token:' ,"data.csv")
Upvotes: 0
Views: 41
Reputation: 82765
You can use str.format
Ex:
a=123
import urllib
testfile = urllib.URLopener()
testfile.retrieve("https://test.test.com/comp/export?format=csv&token:{0}".format(a),"data.csv")
Demo:
a = 123
print("https://test.test.com/comp/export?format=csv&token:{0}".format(a))
https://test.test.com/comp/export?format=csv&token:123
Upvotes: 1