How do I compare values in dictionaries
Question: Currently I'm working on a little project and I keep running into trouble with
this code.

    
    
    import xmlrpclib
    import glob
    import os
    from SimpleXMLRPCServer import SimpleXMLRPCServer
    
    # keep track of all files in directory
    fileList = {} 
    
    # Search for all files in directory
    for file in glob.glob("*.txt"):
        fileList[file] = "closed"
    
    def openFile(filename):
        if filename in fileList.keys(): # Check if file exists
            value = fileList.get(filename)
            if value == 'closed'          # If closed then open
                fileList[filename] = open(filename, 'r+b')
                return "File open"
            else                          # File must have been open
                return "File is already open"
        else                            # File doesn't exist, create one
            # if file not found
            fileList[filename] = open(filename, 'w') # Create file
            return "File created"
    
    def closeFile(filename):
        if filename in fileList.keys(): # Check if file exists
            fileList[filename].close()    # close file
            fileList[filename] = 'closed' # Change value
            return "File closed"
        else
        return "file does not exist"
    
    def readFile(filename):              
        if filename in fileList.keys():    # Check if file exists
            return fileList[filename].read() # Return contents
        else
            return "File does not exist"
    
    def writeFile(filename, content):
        if filename in fileList.keys():     # Check if file exists
            fileList[filename].write(content) # Write content to file
            return "Wrtie successful"
        else
            return "File does not exist"
    
    server = SimpleXMLRPCServer(("localhost", 8000)) # Giving server a port
    print "Listening on port 8000..."
    server.register_function(openFile,'openFile')
    server.register_function(closeFile,'closeFile')
    server.register_function(readFile, 'readFile')
    server.register_function(writeFile, 'writeFile')
    server.serve_forever()
    

For some reason I keep getting:

    
    
    File "server.py", line 16
        if value == 'closed'          # If closed then open
                                                          ^
    SyntaxError: invalid syntax
    

As you can see the syntax is wrong but I have no idea why and any help would
be greatly appreciated.

I have tried to remove the comment but I get the same error message with the
arrow pointing at the last character in the if statement.

I'm new with python but have a year experience with Java so if this also
happens in Java I would probably understand it better in Java terminology.


Answer: You forgot the colon:

    
    
    if value == 'closed':
                        ^-----colon
    

