If Statement Syntax in Python
<p>I get an error with the below code on the line that says, <code>if (str(listGroup) == "FTPDST"):</code>. I'm pretty sure my if, elif, else statement is correct syntax. Please let me know if my syntax is wrong on that line or anywhere else I get errors because the below code won't run, and it throws an <code>SyntaxError: invalid syntax</code> for the line, <code>if (str(listGroup) == "FTPDST")</code>. My list have been initialized in my code. I'm just not showing it below. Thanks.</p>

<pre><code>def parseConfigForIso(searchString, listGroup):
    fi = open(panConfig,"r") 
    for line in fi:
        if searchString in line: 
            lineList=line.split() 
            for item in listList:
                m = re.search(r'(\d{1,3}.){3}\d{1,3}(-\d{2}|slash\d{2})?',item, re.M|re.I)  
                if m:
                    if (str(listGroup) == "FTPDST"): 
                        ftpDstList.append(str(m.group(0))
                    elif (str(listGroup) == "FTPSRC"):
                        ftpSrcList.append(str(m.group(0)) 
                    elif (str(listGroup) == "SSHDST"):
                        sshDstList.append(str(m.group(0))
                    elif (str(listGroup) == "APPID"):
                        appIdList.append(str(m.group(0))
                    else:
                        print "you inputted an incorrect group as a parameter into the parseConfigForIso function"
    fi.close()
parseConfigForIso('search string', "FTPSRC")
</code></pre>

<p>You're missing a <code>)</code> in all <code>.append(str(m.group(0))</code>.</p>

python if-statement