0

I know now in Python 3 Print is a function, but my print, I believe, is in accordance with the syntax, but still giving error Syntax

print (json.dumps(data, indent=4, sort_keys=True))

The output

print ((json.dumps(data, indent=4, sort_keys=True)))
    ^
SyntaxError: invalid syntax
1
  • 1
    The syntax is fine. Is there anything before that statement? Commented Oct 22, 2016 at 23:53

1 Answer 1

1

If the debugger shows at the print while saying that it is an SyntaxError, then you mostly forgot a bracket in the line before it. Can we see some more lines? Like 1 or 2 before it?

Edit: Just an example enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

data = json.loads((request_until_succeed(url).decode('utf-8')) print (json.dumps(data, indent=4, sort_keys=True))
Yeah you forgot the last bracket :D Just add an bracket at the end and you should be fine ^^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.