Brett Quiason Brett Quiason - 5 months ago 26
Python Question

Produce a range of '..' separated numbers

I would like a string like


So far what I have come up with is
a = list(range(5))
, however I need it to output in the format of

so I thought oh this is just a string format so I just did
a = str(list(range(5)))
, but this just makes a
a string.

Im not sure if I am just missing a simple function, or if using
is the correct function.

Answer Source

You can join a list of number strings.

>>> "..".join(map(str, range(5)))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download