[Solved] Invalid syntax python else: [closed]


Your indentation is all over the place – indentation should be in 4 white space blocks, and if and else statements should line up.
A guide to python styling – http://legacy.python.org/dev/peps/pep-0008/#code-lay-out

if os.path.isfile('number.txt'):
    print('ESISTE')
    f = open('number.txt', 'r')
    data = f.read()
    f.close()
    listOfNumber = data[0:12]
    if jid[0:12] in listOfNumber:
        print("PRESENTE")
    else:
        print("DA INSERIRE")
        numberAndMessage = jid[0:12] + " " + messageContent
        listNumberAndMessage.append(data)
        listNumberAndMessage.append(numberAndMessage)

        f = open('number.txt', 'w')
        for item in listNumberAndMessage:
            f.write("%s\n" % item)
        f.close()
else: #line with error
    print('NON ESISTE')

solved Invalid syntax python else: [closed]