Mike McUsic
Mike McUsic

Reputation: 1

Why am I getting an invalid syntax error on this script?

I'm getting an invalid syntax error on the print("Got Here"data) line of the following code. I don't see any syntax errors.

import requests
import json
def test():



    f = open('greenbook_1956.json')
    print("Got Here"data)
    data= json.load(f)
    print(data['rows'][0]) 

Upvotes: 0

Views: 37

Answers (1)

Fares_Hassen
Fares_Hassen

Reputation: 103

swap these two lines:

print("Got Here"data)
data= json.load(f)

and add a comma between data and 'Got Here'!

Upvotes: 1

Related Questions