1

python code line for get value from the form

pass = form.getvalue('name',)

when i try to set form data value to this 'pass' variable it gives two errors near the equal mark.

  1. End of statement expected.

  2. Statement expected, found py:EQ

Why?

2
  • 5
    because pass is a keyword. don't use it as a variable. Commented Oct 11, 2017 at 21:55
  • It works. Thank you very much. i'm just beginning my self study Commented Oct 11, 2017 at 21:57

1 Answer 1

1

you're unlucky enough to have stumbled on a python keyword (the null statement that does nothing except make indentation happy).

hich is currently:

['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import',
 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try',
 'while', 'with', 'yield']

(from Is it possible to get a list of keywords in Python?)

As opposed to built-in functions like sum or list, keywords cannot be used / overridden without triggering strange syntax errors.

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

1 Comment

I didn't find any duplicate to this basic err, python :)) question so I answered as community wiki. If someone finds a proper duplicate feel free to suggest / close

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.