Can I use range of str to get a loop of 12 months?
<p>I would like to use this loop-function for all 12 months. Any idea how to alter the date, tried with a string of values, but I am just lost. Thankful for inputs.</p>

<pre><code>y=str('02','03','04') # Months (Can I use Range here in some way?)
q=('01.'+(y)+'.'+(year)) # Date in file, where the loop break

with open('f.txt','r') as f:
    for line in f:
        if z in line: # Work after this line "z"
            i=0
            c=0
            temp_y=[] # Create empty list
            for line in f:
                temp_1= float((line.split()[i+8])) # Read every 8:th element in file
                temp_y.append(temp_1) # Adds a new value at the neareast empty spot
                c += 1 # For average equation
                print(temp_1)
                if q in line: # (This is where I am stuck)
                    break
</code></pre>

<p>Here is one way:</p>

<pre><code>for month in range(1, 13):
    month = '%02d' % month
    print('01.' + month + '.' + '2016')
</code></pre>

<p>Here is another:</p>

<pre><code>months = ['%02d' % month for month in range(1, 13)]
print (months)
</code></pre>

python string loops