0

I wrote a function. Now I keep getting syntax errors within the try statement. I don't know if its the code I wrote or the try statement

Function:

   def connector (links):
      for links in infile:                    
      avenues = links.rstrip()               
      words = []                          
      dct = {}
      cord = []

There is more to the code but the error keeps occurring in the try statement, where it says except, any ideas?

try:
  infile = open("routes.txt", "r")
  links = inf.readlines()
  Connector(links)
  except LookupError as exceptObj:
      print("Error:", str(exceptObj))
1
  • 1
    connector is lowercase Commented Feb 12, 2016 at 11:37

1 Answer 1

1
  • connector should be lowercase

  • You indented wrong

    try:
      infile = open("routes.txt", "r")
      links = inf.readlines()
      connector(links)
    except LookupError as exceptObj:
      print("Error:", str(exceptObj))
    
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.