Forums

"import copy" giving SyntaxError

Hi!

My simple (but quite long) file requires the copy-method deepcopy(), but when I try to import copy, it shows a SyntaxError.

Why is this?

Here is the first part of my code:

from flask import Flask
app = Flask(__name__)
@app.route('/')

import copy
from random import randint

The "from random import randint" does not work either.

Thank you for your help in this!

the @app.route is definitely in the wrong place

Oh, thanks!

It should be right before a function, right?

Yes