lundi 31 juillet 2017

if flood == "y": SyntaxError: invalid syntax

i have this code,I took it from a person to help him to resolve some issues:

import os
import sys

hostname=raw_input("URL:")
request=raw_input("ping request:")
flood=raw_input("loop mode (y/n):")

def Ping():
    commandSys=os.system("ping -c"+request(hostname)

if flood == "y":
    try:
        while True:
            Ping()
    except KeyboardInterrupt:
        pass
        print "Done"
else:
    Ping()

when i launch this script from the console he tells me there's a sintax error in the if statement PS:i edit the line 9 because ("ping -c"+(request,hostname)) tell me that i "cannot concatenate 'str' and 'tuple' objects"

i hope someone resolve

Aucun commentaire:

Enregistrer un commentaire