SyntaxError: unexpected EOF while parsing (Python)

SyntaxError: unexpected EOF while parsing (Python)

当我尝试同时打印 str 和 len() 时,不断出现 SyntaxError。请指教

companies = [['Google', 'Facebook', 'Apple'],
            ['Warner Bros. Pictures', '20th Century Fox', 'Universal Pictures'],
            ['Whole foods', 'Starbucks', 'Walmart']]


for x in range(len(companies)):
    for y in range(len(companies[x])):
        print("This company name has length of:" + " " + str(len(companies[x][y]))

您刚刚漏掉了一个右括号

companies = [['Google', 'Facebook', 'Apple'],
            ['Warner Bros. Pictures', '20th Century Fox', 'Universal Pictures'],
            ['Whole foods', 'Starbucks', 'Walmart']]


for x in range(len(companies)):
    for y in range(len(companies[x])):
        print("This company name has length of:" + " " + str(len(companies[x][y])))