Misha Eide Misha Eide - 1 year ago 59
Python Question

How do I count up in python with a Url

I'm not really sure how to explain what I am asking.

So what I have written is

count = 1
while count <= 100:
print("https://api.roblox.com/Users/", count)
count += 1

The goal is to print down https://api.roblox.com/Users/(count)

But what it ends up printing is ('https://api.roblox.com/Users/', (count))

Answer Source

You want to create a https://api.roblox.com/Users/(count) string. The way to do it is:

 "https://api.roblox.com/Users/" + str(count)

Your previous code creates a tuple containing a string and an int, which is what is printed:

>>> count = 15
>>> print("https://api.roblox.com/Users/", count)
('https://api.roblox.com/Users/', 15)

But if you concatenate the strings, it does what you want:

>>> count = 15
>>> print("https://api.roblox.com/Users/" + str(count))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download