SyntaxError related to line.rfind
<p>In the past I was using line.rfind to find a fixed variable and my script worked fine. However, now that I am trying to use line.rfind to find a changing variable, I am getting a syntax error for a line of code that used to work. Here is the code I have.</p>

<pre><code>#!usr/bin/env python

import urllib
from datetime import datetime
from datetime import timedelta

date = datetime.now()
date1 = date + timedelta(days=1)

class city :
    def __init__(self, city_name, link, latitude, longitude) :
            self.name = city_name
            self.url = link
            self.low0 = 0
            self.high1 = 0
            self.high2 = 0
            self.low1 = 0
            self.low2 = 0
            self.lat = latitude
            self.long = longitude

    def retrieveTemps(self) :
            filehandle = urllib.urlopen(self.url)

            # get lines from result into array
            lines = filehandle.readlines()

            # (for each) loop through each line in lines
            line_number = 0 # a counter for line number
            for line in lines:
                    line_number = line_number + 1 # increment counter

                    # find string, position otherwise position is -1

                    position0 = line.rfind('title="{}"'.format(date1.strftime("%A"))

                    # string is found in line
                    if position0 &gt; 0 :
                         self.low0 = lines[line_number + 4].split('&amp;')[0].split('&gt;')[-1]
</code></pre>

<p>The error I am getting says...</p>

<pre><code>if position0 &gt; 0 :
                 ^
SyntaxError: invalid syntax
</code></pre>

<p>Any ideas on what is wrong? I assume it is somehow related to the change I made in this line...</p>

<pre><code>position0 = line.rfind('title="{}"'.format(date1.strftime("%A"))
</code></pre>

<p>Thank you for your help!</p>
