Question: I just made a function to generate a list of running ids between a given range. IDs begin with an alphabet and follow with 5 numbers (e.g. A00002). The function below works, but I was wondering if there was a cleaner way to do this. Thanks!

```
def running_ids(start, end):
list = []
start = int(start[1:])
end = int(end[1:])
steps = end - start

def zeros(n):
    zeros = 5 - len(str(n))
    return zeros

while start <= end:
    string = "A" + "0"*zeros(start) + str(start)
    list.append(string)
    start += 1

return list

```

print running\_ids('A00001', 'A00005')

> 
> 
> > 
> > 
> > > 
> > > ['A00001', 'A00002', 'A00003', 'A00004', 'A00005']
> > > 
> > > 
> > > 
> > 
> > 
> > 
> 
> 
>

Answer: 
You could just use simple builtin string formatting:

```
>>> 'A%05d'%1
'A00001'
>>> 'A{0:05d}'.format(1)
'A00001'

```
You can use the builtin [`format`](http://docs.python.org/2/library/functions.html#format) method

```
print "A" + format(1, "05d")   # A00001
print "A" + format(100, "05d") # A00100

```

Or you can use [`str.zfill`](http://docs.python.org/2/library/stdtypes.html#str.zfill) method like this

```
print "A" + str(1).zfill(5)    # A00001
print "A" + str(100).zfill(5)  # A00100

```