0

I get an error with the below code on the line that says, if (str(listGroup) == "FTPDST"):. 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 SyntaxError: invalid syntax for the line, if (str(listGroup) == "FTPDST"). My list have been initialized in my code. I'm just not showing it below. Thanks.

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")
3
  • 1
    Please post the stack trace. It may point to the problem. Commented Oct 3, 2016 at 23:24
  • All .appending lines have unbalanced parenthesis. Three are opened, two are closed. Commented Oct 3, 2016 at 23:24
  • 1
    the line above is missing a paren: ftpDstList.append(str(m.group(0)) Commented Oct 3, 2016 at 23:25

1 Answer 1

4

You're missing a ) in all .append(str(m.group(0)).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.