if index error

Python/problems_python 2021. 2. 2. 13:16

a = "hi"

try:

    if data[0] == ":" and data[-1] == ";":
        print "aa"
    elif data[8] == "{" and data[-3] == "}":
        print "bb"
    else:
        print data
except:
    print data

: