Getting a Syntax Error: if len(sys.argv) =! 5 no clue why the code is wrong
Question: Hello I'm working on my first python script and I've got a

> Syntax Error: if len(sys.argv) =! 5::

I really have no clue what is causing it. I'm using Python v3.3.3 in Wing IDE
5.0 on a windows box. It's my first script but I do know other programming
languages so I don't care if the answer is difficult to understand. It's
probably a noobish error.. Does it maybe have something to do with the new
syntax?

    
    
    import shodan
    import requests
    import sys 
    
    SHODAN_API_KEY = "ENTER API KEY IN HERE"
    api = shodan.Shodan(SHODAN_API_KEY)
    iptotal = ('IP list')
    pagenmbr = 1
    if __name__ == "__main__":
            if len(sys.argv) =! 5:
                    print('Usage: <query> <username> <password> <lastpagenumber')
                    sys.exit(0)
    
                    query = sys.argv[1]
                    username = sys.argv[2]
                    password = sys.argv[3]
                    endpage = sys.argv[4]
                    iteratePage(pagenmbr)
    
    
    
                    def iteratePage(pagenmbr):
                            try:
                                   ...
    
                            except (shodan.APIError, e):
                                    print ('Error: %s' % e)  
    
    pagenmbr = pagenmbr + 1
    
    if pagenmbr <= endpage:
            iteratePage(pagenmbr)
    
    print(iptotal)
    #Append succeeded items to file
    with open("outputsbb.txt", "a") as myfile:
            myfile.write(iptotal)
    

I left out the try commands to save some space. If anybody has had this error
before or could help me with this plz reply and help a fellow coder out it's
really appreciated


Answer: You invert the `!` and the `=` in your condition. You wanted to write:

    
    
    if len(sys.argv) != 5:
         #...
    

See [list of Python
operators](http://www.python.org/doc//current/library/operator.html#mapping-
operators-to-functions)

